Ninad Pathak

Ninad Pathak

Ninad Pathak is a founding member and Editor in Chief at CodeForGeek. He writes about practical AI tooling and developer workflows, and outside work you will likely find him with a book, hot brewed coffee, and ambient music.

Wines Problem Dynamic Programming in C++

Wines Problem Dynamic Programming in C++

The wines problem asks you to sell one bottle from either end of a row each year, with the sale year multiplying its price. Dynamic programming solves it by storing the best revenue for each interval of bottles still in…

Tower of Hanoi in C: Solve the Puzzle

Tower of Hanoi in C: Solve the Puzzle

The Tower of Hanoi puzzle asks you to move a stack of disks between three pegs without placing a larger disk on a smaller one. A C program can print the legal move sequence, one disk at a time. In…

Sort Linked Lists in C++ with Merge Sort

Sort Linked Lists in C++ with Merge Sort

A C++ program can have a chain of nodes that needs sorting before you use its values. A singly linked list stores each value in a node linked to the next, and merge sort orders those nodes by reconnecting them…

Optimal Game Strategy in C++

Optimal Game Strategy in C++

For a row of coins where each turn removes one end, the first player needs a way to guarantee a score against an opponent who also chooses well. The optimal game strategy problem uses interval dynamic programming to find that…

Friends Pairing Problem in C++

Friends Pairing Problem in C++

For a group of n labelled friends, the task is to count the arrangements where each friend stays single or belongs to one pair. The friends pairing problem counts those arrangements. I’ll explain the recurrence by splitting the cases for…

scanf in C: Read User Input

scanf in C: Read User Input

A C program that asks for an age and a city needs to read the values typed at the keyboard. scanf() reads input from the standard input stream and converts it into values your program can store in variables. I’ll…

Top 25 Best Free Linux Games

Top 25 Best Free Linux Games

Every “best free Linux games” list you find is from 2022, and half the games on it are dead. I checked the top results for “best free linux games” and the highest-ranking listicle with actual install commands was last updated…