Coin Change

Problem StatementDynamic Programming (Bottom-Up)Solution ApproachGolang CodeTime and Space Complexity 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…

Escape the Spreading Fire

Problem StatementGolang CodeOutput Problem Statement You are given a 0-indexed 2D integer array grid of size m x n which represents a field. Each cell has one of three values: 0 represents grass, 1 represents fire, 2 represents a…

Course Schedule

Problem StatementGolang SolutionDFSOutput 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…

Top 10 architecture every engineer should know

Top 10 architecture every engineer should knowArchitectural PatternsCloud Native Design PatternsProgramming ParadigmsCode Cleanliness Top 10 architecture every engineer should know Architectural Patterns Monolith: Traditional, single-codebase application structure. Microservices: Small, independent…

Priority Queues

Interview QuestionPriority QueuesGolang SolutionOutput Interview Question Kth Largest Element in an Array Priority Queues Golang Solution //PQ package main import ( "fmt" ) type node struct { distance int vertex…

UnDirected Graph Cycle Detection

Problem StatementImportant LogicGolang SolutionOutput UnDirected Graph Cycle Detection Problem Statement Important Logic Here, in modified DFS, we will start returning value from DFS recursive function. Be careful of accepting this…

Number of Islands

Problem StatementGolang SolutionOutput 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…

Rotting Oranges

Problem StatementRotting OrangesExample 1Example 2Example 3Golang SolutionClean versionOutputSolution Outline1. Identify Key Requirements2. Use BFS for Efficient Traversal3. Initialize the BFS Queue4. Define Directions for Neighboring Cells5. BFS Execution Loop (Minute-by-Minute…

Queue

Implementing a Simple Queue in Go: A Step-by-Step GuideWhat is a Queue?Go's Built-in Slice: Perfect for a QueueGolang code for QueueExample OutputHow It Works1. Enqueue Operation2. Dequeue Operation3. isEmpty FunctionEdge…