Skip to content

aswingt65/100-Days-of-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

100 Days Coding Challenge

I'm publicly committing to the 100DaysOfCode Challenge starting today!

Day 1 [10/09/2023]

Problem : Remove duplicate elements from sorted Array
Statement : Given a sorted array A[] of size N, delete all the duplicated elements from A[]. Modify the array such that if there are X distinct elements in it then the first X positions of the array should be filled with them in increasing order and return the number of distinct elements in the array.
Solution : click here
day1

Day 2 [11/09/2023]

Problem : First Repeating Element
Statement : Given an array arr[] of size n, find the first repeating element. The element should occur more than once and the index of its first occurrence should be the smallest.
Note:- The position you return should be according to 1-based indexing.
Solution : click here
day2

Day 3 [12/09/2023]

Problem : Key Pair
Statement : Given an array Arr of N positive integers and another number X. Determine whether or not there exist two elements in Arr whose sum is exactly X.
Solution : click here
day3

Day 4 [13/09/2023]

Problem : Wave Array
Statement : Given a sorted array arr[] of distinct integers. Sort the array into a wave-like array(In Place). In other words, arrange the elements into a sequence such that arr[1] >= arr[2] <= arr[3] >= arr[4] <= arr[5].....
If there are multiple solutions, find the lexicographically smallest one.
Solution : click here
day4

Day 5 [14/09/2023]

Problem : Bubble Sort
Statement : Given an Integer N and a list arr. Sort the array using bubble sort algorithm.
Solution : click here
day5

Day 6 [15/09/2023]

Problem : Find Transition Point
Statement : Given a sorted array containing only 0s and 1s, find the transition point.
Solution : click here
day6

Day 7 [16/09/2023]

Problem : Union of Two Sorted Arrays
Statement : Union of two arrays can be defined as the common and distinct elements in the two arrays. Given two sorted arrays of size n and m respectively, find their union.
Solution : click here
day7

Day 8 [17/09/2023]

Problem : Search in Linked List
Statement :Given a linked list of n nodes and a key , the task is to check if the key is present in the linked list or not.
Solution : click here
day8

Day 9 [18/09/2023]

Problem : Insertion Sort
Statement :The task is to complete the insert() function which is used to implement Insertion Sort.
Solution : click here
day9

Day 10 [19/09/2023]

Problem : Minimum Cost of ropes
Statement :There are given N ropes of different lengths, we need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. The task is to connect the ropes with minimum cost. Given N size array arr[] contains the lengths of the ropes.
Solution : click here
day10

Day 11 [20/09/2023]

Problem : Level order traversal
Statement :Given a binary tree, find its level order traversal. Level order traversal of a tree is breadth-first traversal for the tree.
Solution : click here
day11

Day 12 [21/09/2023]

Problem : Count the triplets
Statement :Given an array of distinct integers. The task is to count all the triplets such that sum of two elements equals the third element.
Solution : click here
day12

Day 13 [22/09/2023]

Problem : Delete a Node in Single Linked List
Statement :Given a singly linked list and an integer x.Delete xth node from the singly linked list.
Solution : click here
day13

Day 14 [23/09/2023]

Problem : Move all zeroes to end of array
Statement :Given an array arr[] of N positive integers. Push all the zeros of the given array to the right end of the array while maintaining the order of non-zero elements.
Solution : click here
day14

Day 15 [24/09/2023]

Problem : Search in a matrix
Statement :Given a matrix mat[][] of size N x M, where every row and column is sorted in increasing order, and a number X is given. The task is to find whether element X is present in the matrix or not.
Solution : click here
day15

Day 16 [25/09/2023]

Problem : Element with left side smaller and right side greater
Statement :Given an unsorted array of size N. Find the first element in array such that all of its left elements are smaller and all right elements to it are greater than it.
Solution : click here
day16

Day 17 [26/09/2023]

Problem : Delete Middle of Linked List
Statement :Given a singly linked list, delete middle of the linked list. For example, if given linked list is 1->2->3->4->5 then linked list should be modified to 1->2->4->5. If there are even nodes, then there would be two middle nodes, we need to delete the second middle element. For example, if given linked list is 1->2->3->4->5->6 then it should be modified to 1->2->3->5->6. If the input linked list is NULL or has 1 node, then it should return NULL.
Solution : click here
day17

Day 18 [27/09/2023]

Problem : Selection Sort
Statement : Given an unsorted array of size N, use selection sort to sort arr[] in increasing order.
Solution : click here
day18

Day 19 [28/09/2023]

Problem : Josephus problem
Statement : Given the total number of persons n and a number k which indicates that k-1 persons are skipped and kth person is killed in circle in a fixed direction. After each operation, the count will start from k+1th person. The task is to choose the safe place in the circle so that when you perform these operations starting from 1st place in the circle, you are the last one remaining and survive.
Solution : click here
day19

Day 20 [29/09/2023]

Problem : Minimum element in a sorted and rotated array
Statement : A sorted(in ascending order) array A[ ] with distinct elements is rotated at some unknown point, the task is to find the minimum element in it.
Solution : click here
day20

Day 21 [30/09/2023]

Problem : Max Sum without Adjacents
Statement : Given an array Arr of size N containing positive integers. Find the maximum sum of a subsequence such that no two numbers in the sequence should be adjacent in the array.
Solution : click here
day21

Day 22 [01/10/2023]

Problem : Largest subarray of 0's and 1's
Statement : Given an array of 0s and 1s. Find the length of the largest subarray with equal number of 0s and 1s.
Solution : click here
day22

Day 23 [02/10/2023]

Problem : Count all possible paths from top left to bottom right
Statement : The task is to count all the possible paths from top left to bottom right of a m X n matrix with the constraints that from each cell you can either move only to right or down.
Solution : click here
day23

Day 24 [03/10/2023]

Problem : Special Stack
Statement : Design a data-structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return minimum element from the SpecialStack. Your task is to complete all the functions, using stack data-Structure.
Solution : click here
day24

Day 25 [04/10/2023]

Problem : K distance from root
Statement : Given a Binary Tree of size N and an integer K. Print all nodes that are at distance k from root (root is considered at distance 0 from itself). Nodes should be printed from left to right. If k is more that height of tree, nothing should be printed.
Solution : click here
day25

Day 26 [05/10/2023]

Problem : Rotate by 90 degree
Statement : Given a square matrix of size N x N. The task is to rotate it by 90 degrees in anti-clockwise direction without using any extra space.
Solution : click here
day26

Day 27 [06/10/2023]

Problem : Check if Linked List is Palindrome
Statement : Given a singly linked list of size N of integers. The task is to check if the given linked list is palindrome or not.
Solution : click here
day27

Day 28 [07/10/2023]

Problem : Find the number of islands
Statement : Given a grid of size n*m (n is the number of rows and m is the number of columns in the grid) consisting of '0's (Water) and '1's(Land). Find the number of islands.
Solution : click here
day28

Day 29 [08/10/2023]

Problem : Lowest Common Ancestor in a Binary Tree
Statement : Given a Binary Tree with all unique values and two nodes value, n1 and n2. The task is to find the lowest common ancestor of the given two nodes. We may assume that either both n1 and n2 are present in the tree or none of them are present.
Solution : click here
day29

Day 30 [09/10/2023]

Problem : Next Permutation
Statement : Implement the next permutation, which rearranges the list of numbers into Lexicographically next greater permutation of list of numbers. If such arrangement is not possible, it must be rearranged to the lowest possible order i.e. sorted in an ascending order. You are given an list of numbers arr[ ] of size N.
Solution : click here
day30

Day 31 [10/10/2023]

Problem : Validate an IP Address
Statement : Write a program to Validate an IPv4 Address. A valid IPv4 Address is of the form x1.x2.x3.x4 where 0 <= (x1, x2, x3, x4) <= 255. Thus, we can write the generalized form of an IPv4 address as (0-255).(0-255).(0-255).(0-255).
Solution : click here
day31

Day 32 [11/10/2023]

Problem : Total Decoding Messages
Statement : A top secret message containing letters from A-Z is being encoded to numbers using the following mapping:

'A' -> 1
'B' -> 2
...
'Z' -> 26
You are an FBI agent. You have to determine the total number of ways that message can be decoded, as the answer can be large return the answer modulo 10^9 + 7.
Solution : click here
day32

Day 33 [12/10/2023]

Problem : Maximum of all subarrays of size k
Statement : Given an array arr[] of size N and an integer K. Find the maximum for each and every contiguous subarray of size K.
Solution : click here
day33

Day 34 [13/10/2023]

Problem : Pythagorean Triplet
Statement : Given an array arr of n integers, write a function that returns true if there is a triplet (a, b, c) from the array (where a, b, and c are on different indexes) that satisfies a^2 + b^2 = c^2, otherwise return false.
Solution : click here
day34

Day 35 [14/10/2023]

Problem : Connect Nodes at Same Level
Statement : Given a binary tree, connect the nodes that are at same level. You'll be given an addition nextRight pointer for the same. Initially, all the nextRight pointers point to garbage values. Your function should set these pointers to point next right for each node.
Solution : click here
day35

Day 36 [15/10/2023]

Problem : Implementing Dijkstra Algorithm
Statement : Given a weighted, undirected and connected graph of V vertices and an adjacency list adj where adj[i] is a list of lists containing two integers where the first integer of each list j denotes there is edge between i and j , second integers corresponds to the weight of that edge . You are given the source vertex S and You to Find the shortest distance of all the vertex's from the source vertex S. You have to return a list of integers denoting shortest distance between each node and Source vertex S.
Solution : click here
day36

Day 37 [16/10/2023]

Problem : Knapsack with Duplicate Items
Statement : Given a set of N items, each with a weight and a value, represented by the array w and val respectively. Also, a knapsack with weight limit W. The task is to fill the knapsack in such a way that we can get the maximum profit. Return the maximum profit.
Solution : click here
day37

Day 38 [17/10/2023]

Problem : Minimum Spanning Tree
Statement : Given a weighted, undirected and connected graph of V vertices and E edges. The task is to find the sum of weights of the edges of the Minimum Spanning Tree. Given adjacency list adj as input parameters . Here adj[i] contains vectors of size 2, where the first integer in that vector denotes the end of the edge and the second integer denotes the edge weight.
Solution : click here
day38

Day 39 [18/10/2023]

Problem : Construct Tree from Inorder & Preorder
Statement : Given 2 Arrays of Inorder and preorder traversal. The tree can contain duplicate elements. Construct a tree and print the Postorder traversal.
Solution : click here
day39

Day 40 [19/10/2023]

Problem : Egg Dropping Puzzle
Statement : You are given N identical eggs and you have access to a K-floored building from 1 to K. There exists a floor f where 0 <= f <= K such that any egg dropped from a floor higher than f will break, and any egg dropped from or below floor f will not break. There are few rules given below.

  • An egg that survives a fall can be used again.
  • A broken egg must be discarded.
  • The effect of a fall is the same for all eggs.
  • If the egg doesn't break at a certain floor, it will not break at any floor below.
  • If the eggs breaks at a certain floor, it will break at any floor above.

Return the minimum number of moves that you need to determine with certainty what the value of f is.
Solution : click here
day40

Day 41 [20/10/2023]

Problem : Floyd Warshall
Statement : The problem is to find the shortest distances between every pair of vertices in a given edge-weighted directed graph. The graph is represented as an adjacency matrix of size n*n. Matrix[i][j] denotes the weight of the edge from i to j. If Matrix[i][j]=-1, it means there is no edge from i to j.
Solution : click here
day41

Day 42 [21/10/2023]

Problem :
Statement : Given a gold mine called M of (n x m) dimensions. Each field in this mine contains a positive integer which is the amount of gold in tons. Initially the miner can start from any row in the first column. From a given cell, the miner can move

  1. to the cell diagonally up towards the right
  2. to the right
  3. to the cell diagonally down towards the right
Find out maximum amount of gold which he can collect.

Solution : click here
day42

Day 43 [22/10/2023]

Problem : Min distance between two given nodes of a Binary Tree
Statement : Given a binary tree and two node values your task is to find the minimum distance between them. The given two nodes are guaranteed to be in the binary tree and nodes are numbered from 1 to N. Please Note that a and b are not always leaf node.
Solution : click here
day43

Day 44 [23/10/2023]

Problem : M-Coloring Problem
Statement : Given an undirected graph and an integer M. The task is to determine if the graph can be colored with at most M colors such that no two adjacent vertices of the graph are colored with the same color. Here coloring of a graph means the assignment of colors to all vertices. Print 1 if it is possible to colour vertices and 0 otherwise.
Solution : click here
day44

Day 45 [24/10/2023]

Problem : Shortest Common Supersequence
Statement : Given two strings X and Y of lengths m and n respectively, find the length of the smallest string which has both, X and Y as its sub-sequences.
Solution : click here
day45

Day 46 [25/10/2023]

Problem : Smallest distinct window
Statement : Given a string 's'. The task is to find the smallest window length that contains all the characters of the given string at least one time.
Solution : click here
day46

Day 47 [26/10/2023]

Problem : Word Break
Statement : Given a string A and a dictionary of n words B, find out if A can be segmented into a space-separated sequence of dictionary words.
Solution : click here
day47

Day 48 [27/10/2023]

Problem : Strongly Connected Components (Kosaraju's Algo)
Statement : Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, Find the number of strongly connected components in the graph.
Solution : click here
day48

Day 49 [28/10/2023]

Problem : Steps by Knight
Statement : Given a square chessboard, the initial position of Knight and position of a target. Find out the minimum steps a Knight will take to reach the target position.
Solution : click here
day49

Releases

No releases published

Packages

No packages published

Languages