---
title: "Discussion on \"89. Gray Code\" | Hashnode"
description: "Discussion on \"89. Gray Code\". Link\nkey ideas\n\nCreate an array res with size 2^n\n\nSet res[0] = 0 as the base case\n\nIterate over the array, trying to insert a valid number in every iteration.\n\nTo find a valid number, we create another loop, and in this nested loop:\n\ntoggle the righ..."
url: "https://hashnode.com/posts/89-gray-code/63a6f5bc6e98c84377a62f0c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [89\. Gray Code](https://brianhu.hashnode.dev/89-gray-code?utm_source=hashnode&utm_medium=feed)

Link key ideas Create an array res with size 2^n Set res\[0\] = 0 as the base case Iterate over the array, trying to insert a valid number in every iteration. To find a valid number, we create another loop, and in this nested loop: toggle the righ...

Dec 24, 2022 · 2 min read · brianhu.hashnode.dev  
Read the article

-   [#bit-manipulation](https://hashnode.com/tag/bit-manipulation)

## Written by

[Brian Hu](https://hashnode.com/@brianhu)

@brianhu

  
[View profile](https://hashnode.com/@brianhu)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
