gpt4 book ai didi

c - 微软面试——图像位图

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:26:02 26 4
gpt4 key购买 nike

我正在研究旧的 MS 问题并遇到了这个问题:

A pic has a bitmap assoc with it and a 256 long array of original palettes. Now we have a change list, where some old colors are mapped onto new colors. Write the code to change the original palette. Now if the original bitmap has to be changed, write the code that will scan the pic as well as the changed palette array. The code should be O(N) and not O(N^2). The struct of the original palette may be changed to accomplish this.

我无法找出确切的问题。如果有人可以说明问题和标准方法,那就太好了。非常感谢。

最佳答案

我认为这类问题应该通过与招聘人员的互动来解决。

我的方法如下:

for each *element* in *image data*
if *palette value* in *element* contains *old value*
update *palette value* with *new value*
end
process *element*
end

上面可能没有更新一些值(对于图像中不存在的一些调色板值的情况),但我认为这是处理这个问题的一种简单方法。

问候

关于c - 微软面试——图像位图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13151019/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com