由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一个leetcode题目的扩展?
相关主题
贡献一道面试题等拒信中,求安慰
再来一道简单的bit运算题amazon背靠背电面
Careercup question.问道题leetcode的题,关于bit运算的
看一道面试题snapchat 面经+offer
问一个关于xor的题问到题目
a question about bits operation这个followup 如何做? 求思路
bit manipulation 小题Maximum Contiguous Subarray
switch odds and evens bits of an integer一个面经
相关话题的讨论汇总
话题: bits话题: binary话题: integer话题: given
进入JobHunting版参与讨论
1 (共1页)
s***g
发帖数: 1250
1
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as
00000010100101000001111010011100), return 964176192 (represented in binary
as 00111001011110000010100101000000).
Follow up:
If this function is called many many times, how would you optimize it?
这个followup应该怎么解决呢?之前其他的题也被问过类似的问题。谢谢
b**********5
发帖数: 7881
2
我想是precalculation, 然后存hashtable, key是integer, value就是reversed的
integer

【在 s***g 的大作中提到】
: Reverse bits of a given 32 bits unsigned integer.
: For example, given input 43261596 (represented in binary as
: 00000010100101000001111010011100), return 964176192 (represented in binary
: as 00111001011110000010100101000000).
: Follow up:
: If this function is called many many times, how would you optimize it?
: 这个followup应该怎么解决呢?之前其他的题也被问过类似的问题。谢谢

l*y
发帖数: 70
3
2^32个long 是32G要存成map更大。
不如存2^16个int的map,算的时候分两段ab各长16bit,分别翻一下再倒过来。
如果认为512KB还大可同理分4个8-bit...
1 (共1页)
进入JobHunting版参与讨论
相关主题
一个面经问一个关于xor的题
Help, Algorithms questionsa question about bits operation
一道 Amazon DP题bit manipulation 小题
Subtraction for link list represented integerswitch odds and evens bits of an integer
贡献一道面试题等拒信中,求安慰
再来一道简单的bit运算题amazon背靠背电面
Careercup question.问道题leetcode的题,关于bit运算的
看一道面试题snapchat 面经+offer
相关话题的讨论汇总
话题: bits话题: binary话题: integer话题: given