Is this not incorrect?

📰 Reddit r/learnprogramming

Learn to identify and fix a common mistake in grid initialization in coding interviews

beginner Published 12 Jun 2026
Action Steps
  1. Watch the Youtube video 'How to solve a Google coding interview question' to understand the context
  2. Identify the grid initialization code and check for potential mistakes
  3. Swap the height and width variables in the grid initialization code to fix the mistake, e.g., [0]*width for i in range(height)
  4. Test the corrected code to ensure it produces the expected output
  5. 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
Read full article → ← Back to Reads

Related Videos

Arrays vs Lists: What AI Actually Prefers | Common Tech Interview Questions
Arrays vs Lists: What AI Actually Prefers | Common Tech Interview Questions
SCALER
Why India Needs a New Kind of Hardware Engineer | Kunal Ghosh, Co-Founder at VSD | Scaler Pod
Why India Needs a New Kind of Hardware Engineer | Kunal Ghosh, Co-Founder at VSD | Scaler Pod
SCALER
10-Phase Deep Learning Roadmap 2026 | AI & Neural Networks | #shorts
10-Phase Deep Learning Roadmap 2026 | AI & Neural Networks | #shorts
SCALER
Deep Dive into Scaler's Advanced AI & Machine Learning Programme
Deep Dive into Scaler's Advanced AI & Machine Learning Programme
SCALER
8-Step Data Science Roadmap 2026 | AI & Machine Learning | #shorts
8-Step Data Science Roadmap 2026 | AI & Machine Learning | #shorts
SCALER
Deep Dive into Scaler's Modern Data Science and ML Programme with Specialisation in AI
Deep Dive into Scaler's Modern Data Science and ML Programme with Specialisation in AI
SCALER