Skip to content

A list of coding questions I solved (DS-Algo & CP) πŸ‘¨β€πŸ’» to enhance my algorithmic thinking skills. Also includes: Notes ✍ | Resources | Core-CS Subjects πŸ“š | Off-Campus... 🌏

Notifications You must be signed in to change notification settings

Surajv311/myProgramming_Interview-Prep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

myProgramming πŸ‘¨β€πŸ’»

DS-Algo, CP Questions | CS-Core subjects | Notes | Practice | Resources to improve...! πŸš€


This repository hosts a list of DS-Algo Questions that I've solved, CS-Core Questions and resources that I have been following, and the handwritten notes I made; To improve my thinking skills to crack the opportunities that come in my way.

In progress: Since Nov 2020 - present.

Table of contents:



Noob

  1. Written beginner level codes in Py/Java/C/C++ to get an experience of every language.

Codes in C | Codes in Cpp | Codes in Java | Codes in Python.

  1. Learned Git/Github.

  2. Finally decided to go with C++ (cpp).


Pro_Noob

A compiled list of resources that I have been following and questions that I have been practising:

Competitive Coding

Practised & Learned from Internet

GFG | Hackerrank | Leetcode | Youtube University | Misc

Internship & Placements specific preparation (that I've done)

Others


Notes

Link to my handwritten notes (updated occasionally):

Drive link: link (or) Github repo link: link

(both links host the same notes)


DS-Algo-Qs

  • This section consists of a list of DS-Algo Questions that I have practised for internships/placements:
  • These questions can be accessed via this path:
    myProgramming/Coding/[IMP] INTERN-PLACEMENTS-PREP/DS-ALGO_QUESTIONS_[SOLVED]/ .
    (Link)
  • Note: The main ans logic of the question is coded & just pasted in main function, than creating a separate function...!.

Contents:


Basics

Data Structure Code
Graph Check
Linkedlist Check
Tree Check

Arrays

Problem Link My Solution
Two numbers with sum closest to 0 Visit Check
Convert array to zig-zag fashion Visit Check
Boolean Matrix Visit Check
Chocolate Distribution Problem Visit Check
Consecutive 1's not allowed Visit Check
Contiguous Subarray with given sum Visit Check
Count Inversions Visit Check
Count the triplets Visit Check
Element with left side smaller and right side greater Visit Check
Equilibrium Point Visit Check
Find Missing And Repeating Visit Check
Kadane's Algorithm Visit Check
Kth smallest element Visit Check
Largest Number formed from an Array Visit Check
Last index of One Visit Check
Leaders in an array Visit Check
Majority Element Visit Check
Maximum Index Visit Check
Merge Without Extra Space Visit Check
Minimum Platforms Visit Check
Missing number in array Visit Check
Nuts and Bolts Problem Visit Check
Pythagorean Triplet Visit Check
Rearrange Array Alternately Visit Check
Smallest Positive missing number Visit Check
Reverse array in groups Visit Check
Sort an array of 0s, 1s and 2s Visit Check
Spirally traversing a matrix Visit Check
Stock buy and sell Visit Check
Trapping Rain Water Visit Check
Find All Four Sum Numbers Visit Check
Find the Duplicate Number Visit Check
Fractional Knapsack Visit Check
Max Consecutive Ones Visit Check
Merge Intervals Visit Check
Next Permutation Visit Check
Count all possible paths from top left to bottom right Visit Check
Remove Duplicates from Sorted Array Visit Check
Reverse Pairs Visit Check
Rotate Image Visit Check

String

Problem Link My Solution
Check if string is rotated by two places Visit Check
Longest Palindrome in a String Visit Check
Smallest window in a string containing all the characters of another string Visit Check
Permutations of a given string Visit Check
Remove All Adjacent Duplicates In String Visit Check
Remove Duplicates Visit Check
Reverse words in a given string Visit Check
Longest Substring Without Repeating Characters Visit Check
Anagram Visit Check
Longest Prefix Suffix - KMP Algo Visit Check
Implement strstr & Rabin Karp Algo Visit Check
Roman Number to Integer Visit Check

LinkedList

Problem Link My Solution
Construct a Linkedlist Visit Check
Implement Queue using Linked List Visit Check
Implement Stack using Linked List Visit Check
Finding middle element in a linked list Visit Check
Pairwise swap elements of a linked list Visit Check
Remove loop in Linked List Visit Check
Reverse a linked list Visit Check
Rotate a Linked List Visit Check
Sort a linked list of 0s, 1s and 2s Visit Check
Check if the linked list has loop or not (Floyd's Algorithm) Visit Check
Add two numbers represented by linked lists Visit Check
Check if Linked List is Palindrome Visit Check
Flattening a Linked List Visit Check
Nth node from end of linked list Visit Check
Insert and delete from doubly linkedlist Visit Check
Intersection point of two linked lists Visit Check
Linked List Cycle II Visit Check
Merge two sorted linked lists Visit Check
Reverse a Linked List in groups of given size Visit Check

Stack_Queue

Problem Link My Solution
First non-repeating character in a stream Visit Check
Gas Station (Circular Tour) Visit Check
Get minimum element from stack Visit Check
Largest Rectangular Area in a Histogram Visit Check
LRU Cache Visit Check
Maximum of all subarrays of size k Visit Check
Given a binary matrix, find the maximum size rectangle binary-sub-matrix with all 1’s Visit Check
Special Stack Visit Check
Next Greater Element Visit Check
Next Greater Element (Right) Visit Check
Parenthesis Checker Visit Check
Queue using two Stacks Visit Check
Rotten Oranges Visit Check
Stack using two queues Visit Check
Stack using two queues Visit Check
Stock Span Problem Visit Check

Trees

(Binary Tree)

Problem Link My Solution
Level order traversal (BFS) Visit Check
Inorder Traversal (Iterative & Recursive) Visit Check
Postorder Traversal (Iterative & Recursive) Visit Check
Preorder Traversal (Iterative & Recursive) Visit Check
Lowest Common Ancestor in a Binary Tree Visit Check
Constructing BT Visit Check
Binary Tree to DLL Visit Check
Bottom View of Binary Tree (Iterative & Recursive) Visit Check
Check for Balanced Tree Visit Check
Determine if Two Trees are Identical Visit Check
Check if Tree is Isomorphic Visit Check
Symmetric Tree Visit Check
Count Leaves in Binary Tree Visit Check
Diameter of Binary Tree Visit Check
Flatten Binary Tree to Linked List Visit Check
Height of Binary Tree Visit Check
Left View of Binary Tree (Iterative & Recursive) Visit Check
Binary Tree Maximum Path Sum Visit Check
Mirror Tree Visit Check
Serialize and Deserialize a Binary Tree Visit Check
Level order traversal in spiral form Visit Check
Top View of Binary Tree Visit Check
Tree from Postorder and Inorder Visit Check
Construct Tree from Inorder & Preorder Visit Check
Vertical Traversal of Binary Tree Visit Check

(Binary Search Tree)

Problem Link My Solution
Constructing a BST Visit Check
Lowest Common Ancestor in a BST Visit Check
Check for BST Visit Check
Floor and Ceil from a BST Visit Check
k-th smallest element in BST Visit Check
Largest BST Visit Check
Find a pair with given target in BST Visit Check
Populating Next Right Pointers in Each Node Visit Check

Heap

Problem Link My Solution
Heap Sort Visit Check
Kth largest element in a stream Visit Check
Find median in a stream Visit Check
Merge K sorted linked lists Visit Check
Find k closest numbers in an unsorted array Visit Check
Find k numbers with most occurrences in the given array Visit Check
K’th Smallest/Largest Element in Unsorted Array Visit Check
Connect n ropes with minimum cost Visit Check
Sort a K Sorted (nearly sorted) Array Visit Check

Recursion

Problem Link My Solution
Flood fill Algorithm Visit Check
Josephus problem Visit Check
Number of paths Visit Check
Special Keyboard Visit Check
Generate all balanced parenthesis Visit Check
Combination Sum I Visit Check
Combination Sum II Visit Check
kth symbol in grammar Visit Check
Letter case permutation Visit Check
Permutation Sequence Visit Check
Permutation with spaces Visit Check
Reverse a stack using recursion Visit Check
Sort an array recursively Visit Check
Subset Sums Visit Check

Hashing

Problem Link My Solution
Zero Sum Subarrays Visit Check
Find all pairs with a given sum Visit Check
Common Elements Visit Check
Count distinct elements in every window Visit Check
Longest Continuous Increasing Subsequence Visit Check
Longest Consecutive Sequence Visit Check
Sort an array according to the other Visit Check
Sorting Elements of an Array by Frequency Visit Check

Graph

Problem Link My Solution
BFS of graph Visit Check
DFS of Graph Visit Check
Find whether path exist Visit Check
Alien Dictionary Visit Check
Detect cycle in a directed graph Visit Check
Detect cycle in an undirected graph Visit Check
Floyd Warshall Visit Check
Minimum Swaps to Sort Visit Check
Find the number of islands Visit Check
Topological sort Visit Check
Dijkstra's Algorithm - Shortest Path in Undirected Graph Visit Check
Bellman Ford Algorithm - Detect Negative Weight Cycle in Graphs Visit Check
Check if it's a Bipartite Graph Visit Check
Bridges in Graph (or) Cut Edge Visit Check
Disjoint Set - Union By Rank and Path Compression Visit Check
Kosaraju's Algorithm for Strongly Connected Components (SCC) Visit Check
Kruskal's Algorithm to find MST Visit Check
MST Prims Algo Visit Check
Shortest Path in Undirected Graph with Unit Weights Visit Check
Shortest Path in Directed Acyclic Graph (DAG) Visit Check

Greedy

Problem Link My Solution
Activity Selection Visit Check
Largest number with given sum Visit Check
Maximize Toys Visit Check
Minimize the Heights II Visit Check
Minimize the sum of product Visit Check
N meetings in one room Visit Check
Job Sequencing Problem Visit Check
Greedy Algorithm to find Minimum number of Coins Visit Check

DP

Problem Link My Solution
Box Stacking Visit Check
Count number of hops Visit Check
Max length chain Visit Check
Minimum number of jumps Visit Check
Minimum Operations Visit Check
0/1 Knapsack Problem (DP) Visit Check
0/1 Knapsack Problem (Memoization) Visit Check
Count ways to reach the n'th stair Visit Check
Get Minimum Squares Visit Check
Find length of longest common subsequence & print the subsequence (string) Visit Check
Given two strings β€˜X’ and β€˜Y’, find the length of the longest common substring Visit Check
Longest Palindromic Subsequence Length Visit Check
Shortest Common Supersequence Length Visit Check
Longest Increasing Subsequence Visit Check
Coin change problem - I Visit Check
Coin change problem - II Visit Check
Count number of subset with a given difference / Target Sum Visit Check
Count subsets sum with X Visit Check
Edit Distance Visit Check
Egg dropping problem Visit Check
Partition problem Visit Check
House Robber Visit Check
Longest Repeated Subsequence Visit Check
Maximum Product Subarray Visit Check
Maximum sum increasing subsequence Visit Check
Matrix Chain Multiplication Visit Check
Minimum number of deletions to make a string palindrome Visit Check
Minimum Path Sum Visit Check
Minimum sum partition Visit Check
Palindrome partitioning problem Visit Check
Printing Shortest Common Supersequence Visit Check
Maximize The Cut Segments/ Rod Cutting Visit Check
Scrambled String Visit Check
Sequence Pattern Matching Visit Check
Subset sum problem Visit Check
Minimum number of deletions and insertions to transform one string into another Visit Check
Knapsack with Duplicate Items/ Unbounded Knapsack Visit Check
Weighted Job Scheduling Visit Check
Word Break Visit Check

Backtracking

Problem Link My Solution
N-Queen Problem Visit Check
Word Boggle Visit Check
M-Coloring Problem Visit Check
Permutations of a given string Visit Check
Print all possible paths from top left to bottom right of a mXn matrix Visit Check
Rat in a Maze Problem - I Visit Check
Sudoku Solver Visit Check

Bit_Magic

Problem Link My Solution
BASIC Bit Operations Visit Page Check
Find first set bit Visit Check
Find the 2 unique numbers from an array where all numbers are repeated twice except the two Visit Check
Find number of ones in bits of a number Visit Check
Check if no. is power of 2 Visit Check
Power Set Visit Check
Find the unique number from an array where all numbers are repeated THRICE except the unique one Visit Check
Find the unique number from an array where all numbers are repeated TWICE except the unique one Visit Check

Sorting_Algos

Problem Link My Solution
Bubble Sort Visit Check
Counting Sort Visit Check
Heap Sort Visit Check
Insertion Sort Visit Check
Merge Sort Visit Check
Quick Sort Visit Check
Radix Sort Visit Check
Selection Sort Visit Check
Shell Sort Visit Check

Misc

Problem Link My Solution
Allocate minimum number of pages Visit Check
Binary Search Visit Check
Given two number x and n, find n-th root of x Visit Check
Find the element that appears once in sorted array Visit Check
Floor in a Sorted Array Visit Check
Median in a row-wise sorted Matrix Visit Check
Nth Natural Number Visit Check
Find the Rotation Count in Rotated Sorted array Visit Check
Search in row wise and column wise sorted array Visit Check
Sum of Middle Elements of two sorted arrays Visit Check
The Celebrity Problem Visit Check
Trailing zeroes in factorial Visit Check
Miscellaneous Qs - Check

  • Side Note: Github gist to some random questions solved again for practice from Leetcode/GFG/Neetcode, etc. ~ Gist

Author



Releases

No releases published

Packages

No packages published

Languages