Skip to content

Create 190.reverse_bit.md#23

Open
Kitaken0107 wants to merge 1 commit intomainfrom
Kitaken0107-patch-25
Open

Create 190.reverse_bit.md#23
Kitaken0107 wants to merge 1 commit intomainfrom
Kitaken0107-patch-25

Conversation

@Kitaken0107
Copy link
Owner

@liquo-rice
Copy link

文字列に変換しないでやってみてください。ビット操作の問題だと思います。

n = format(n ,'b')
n = n.zfill(32)
return int(n[::-1],2)
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんとなく、これは作意解ではない気がしています。ループで書けませんか。

32 bit 整数って、シフト演算をして、最下位ビットを見ると、スタックみたいなものじゃないですか。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants