Author: prakashsinghabody@gmail.com

Interview Questions

Coin Change

Problem Statement You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have […]

prakashsinghabody@gmail.com 
Interview Questions

Course Schedule

Problem Statement There are a total of numCourses courses you have to take, labeled from 0 to numCourses – 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. Return true if you can finish all courses. Otherwise, return false. Example 1: Input: numCourses = 2, prerequisites = [[1,0]] Output: true Explanation: There are a […]

prakashsinghabody@gmail.com 
Interview Questions

Number of Islands

Leetcode#200 Problem Statement Given an m x n 2D binary grid grid which represents a map of ‘1’s (land) and ‘0’s (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: Input: grid = [ [“1″,”1″,”1″,”1″,”0”], […]

prakashsinghabody@gmail.com 
Interview Questions

Rotting Oranges

Problem Statement Leetcode#994 Rotting Oranges You are given an m x n grid where each cell can have one of three values: Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must elapse until no cell has a fresh orange. If this is impossible, return -1. Example 1 Input: grid […]

prakashsinghabody@gmail.com 
Interview Questions

Queue

Implementing a Simple Queue in Go: A Step-by-Step Guide When working with data structures in Go, understanding how to implement a basic queue is a crucial skill. A queue operates on a First In, First Out (FIFO) principle, meaning the first element added is the first one to be removed. In this post, we’ll walk […]

prakashsinghabody@gmail.com