Some interesting computer science problems and solutions in C#
- Array in zig-zag fashion (Implementation | Tests)
All are top down solutions with memoization technique.
- Tower of hanoi (Implementation | Tests)
- Fibonacci number generator (Implementation | Tests)
- Optimal game strategy (Implementation | Tests)
- Optimal Binary Search Tree (Implementation | Tests)
- Max submatrix (Implementation | Tests)
- Min cost matrix path (Implementation | Tests)
- Chain matrix multiplication (Implementation | Tests)
- Max 1s Rectangle in matrix (Implementation | Tests)
- Max 1s Square in matrix (Implementation | Tests)
- Max subsquare with X sides in matrix (Implementation | Tests)
- Count bool parenthesization (Implementation | Tests)
- Count decoding (Implementation | Tests)
- Dice throw (Implementation | Tests)
- Count possible binary tree from a preorder sequence (Implementation | Tests)
- Ways to cover a distance (Implementation | Tests)
- Staircase problem in Fibornacci Series (Implementation | Tests)
- Count digits (Implementation | Tests)
- Knapsack problem (Implementation | Tests)
- Max sum subsequence (Implementation | Tests)
- Max increasing sum sequence (Implementation | Tests)
- Max profit buy/sell stocks in K transactions (Implementation | Tests)
- Box Stacking (Implementation | Tests)
- Building Bridges (Implementation | Tests)
- Burst Balloon (Implementation | Tests)
- Cutting Rod (Implementation | Tests)
- Print Max A's (Implementation | Tests)
- Weighted Job Scheduling (Implementation | Tests)
- Longest Chain (Implementation | Tests)
- Coin change problem (Implementation | Tests)
- Assembly line scheduling (Implementation | Tests)
- Min Egg drop problem (Implementation | Tests)
- Min edit distance (Implementation | Tests)
- Min array jumps (Implementation | Tests)
- Longest palindrome (Implementation | Tests)
- Shortest palindrome (Implementation | Tests)
- Palindrome min cut (Min Partitioning) (Implementation | Tests)
- Min deletion to get a palindrome (Implementation | Tests)
- Balanced partition (Implementation | Tests)
- Distinct binary strings (Implementation | Tests)
- Longest common subsequence (Implementation | Tests)
- Longest increasing subsequence (Implementation | Tests)
- Longest bitonic sequence (Implementation | Tests)
- Subset sum (Implementation | Tests)
- Wild card matching (Implementation | Tests)
- String interleaving (Implementation | Tests)
- Text Justification (Implementation | Tests)
- Word Break problem (Implementation | Tests)
- Find the element that appears once (Implementation | Tests)
- Find the two non-repeating elements in an array (Implementation | Tests)
- Find two repeating elements in an array (Implementation | Tests)
- Set bits in all numbers from 1 to n (Implementation | Tests)
- Swap without temp (Implementation | Tests)
- Swap all odd and even bits (Implementation | Tests)
- Swap bits (Implementation | Tests)
- Minimum or Maximum of two integers (Implementation | Tests)
- Add two numbers using bitwise operators (Implementation | Tests)
- Add 1 to a number (Implementation | Tests)
- A Boolean Array Puzzle (Implementation | Tests)
- Set bits in an (big) array (Implementation | Tests)
- Next higher/lower number with same number of set bits (Implementation | Tests)
- Absolute value (abs) without branching (Implementation | Tests)
- Reverse Bits of a Number (Implementation | Tests)
- Find parity (Implementation | Tests)
- Maximum Subarray XOR (Implementation | Tests)
- Magic Number (Implementation | Tests)
- Sum of bit differences among all pairs (Implementation | Tests)
- Find Next Sparse Number (Implementation | Tests)
- Binary Subsets (Implementation | Tests)
- Calculate Logarithm (base 2 & 10) (Implementation | Tests)
- Check if word has a zero byte (Implementation | Tests)
- Interleave (Morton Number) (Implementation | Tests)
- Flip a bit for longest ones sequence (Implementation | Tests)
- Count Inversions (Implementation | Tests)
- Balanced Parentheses (Implementation | Tests)