Is this not incorrect?
📰 Reddit r/learnprogramming
Learn to identify and fix a common mistake in grid initialization in coding interviews
Action Steps
- Watch the Youtube video 'How to solve a Google coding interview question' to understand the context
- Identify the grid initialization code and check for potential mistakes
- Swap the height and width variables in the grid initialization code to fix the mistake, e.g., [0]*width for i in range(height)
- Test the corrected code to ensure it produces the expected output
- Practice initializing grids with correct dimensions to build muscle memory
Who Needs to Know This
Junior developers and coding interviewees can benefit from understanding this concept to improve their coding skills
Key Insight
💡 Grid initialization requires careful attention to dimension variables to avoid mistakes
Share This
🚨 Coding interview tip: Double-check your grid initialization code to avoid mixing up height and width! 💡
Key Takeaways
Learn to identify and fix a common mistake in grid initialization in coding interviews
Full Article
This is from the Youtube video 'How to solve a Google coding interview question'. The coder's intention was to create a copy of the grid with only 0's. I've only been coding for a few weeks, so forgive me if I'm wrong, but has he not mixed the height and width up in this part? 0*height for i in range(width), am I right? He uses the correct variables in the next part, but that doesn't matter if the grid dimensions are incorrect. If I'm correct that
DeepCamp AI