Code daily , Add your solutions to the Repo by making a pull request, you can also edit/add multiple solutions to the solved problems
- Day 1: Program to identify if the character is a vowel or consonant.
- Day 2: Program to identify if the character is an alphabet or not.
- Day 3: Program to find ASCII values of a character.
- Day 4: Program to identify if the number is positive or negative.
- Day 5: Program to identify if the number is even or odd.
- Day 6: Program to find the Quadrant in which coordinate lies.
- Day 7: Program to find Number of days in a given month of a given year.
- Day 8: Program to find roots of a quadratic equation.
- Day 9: Program to find number of digits in an integer.
- Day 10: Program to find Factorial of a number.
- Day 11: Program to find Fibonacci series up to n.
- Day 12: Program to find Sum of digits of a number.
- Day 13: Program to find Sum of N natural numbers.
- Day 14: Program to reverse a given number.
- Day 15: Program to identify if the number is Strong number or not.
- Day 16: Program to identify if the number is Perfect number or not.
- Day 17: Program to find the Factors of a number.
- Day 18: Program to Add two fractions.
- Day 19: Program to identify if the number is Armstrong number or not.
- Day 20: Program to identify if the number is Prime number or not.
- Day 21: Program to identify if the number is Palindrome or not.
- Day 22: Program to express a number as a sum of two prime numbers.
- Day 23: Program to Replace all 0’s with 1's in a given integer.
- Day 24: Program to print Pyramid pattern using stars.
- Day 25: Program to find Area of a circle.
- Day 26: Program to calculate Maximum number of handshakes.
- Day 27: Program to find the double of the given number without using arithmetic operator.
- Day 28: Program to reverse a string.
- Day 29: Program to concatenate a string.
- Day 30: Program to print Length of the string without using strlen() function.
- Day 31: Program to Toggle each character in a string.
- Day 32: Program to Remove vowels from a string.
- Day 33: Program to check if String is a palindrome or not.
- Day 34: Program to Remove brackets from an algebraic expression.
- Day 35: Program to count the sum of numbers in a string.
- Day 36: Program to Capitalize the first and last letter of each word of a string.
- Day 37: Program to calculate the Frequency of characters in a string.
- Day 38: Program to print Non-repeating characters in a string.
- Day 39: Program to check if two strings are Anagram or not.
- Day 40: Program to Replace substring in a string.
- Day 41: Program to Check if two strings match where one string contains wildcard characters.
- Day 42: Program to check if two arrays are the same or not.
- Day 43: Program to find the array type.
- Day 44: Program to find number of even and odd elements in an array.
- Day 45: Program to find smallest and largest element in an array.
- Day 46: Program to find sum of elements in an array.
- Day 47: Program to find longest palindrome in an array.
- Day 48: Program to remove duplicate elements in an array.
- Day 49: Given 2 integer arrays X and Y of same size. Consider both arrays as vectors and print the minimum scalar product (Dot product) of 2 vectors.
- Day 50: Given an integer array of size N. Write Program to find sum of positive square elements in the array.
- Day 51: Given an integer array of size N,write a program to sort the array.
- Day 52: Given an integer array of size N, write a program to reverse the array.
- Day 53: Given an integer array of size N. Write Program to find maximum product subarray in a given array.
- Day 54: Given an integer array of size N. Write Program to find whether Arrays are disjoint or not. Two arrays are said to be disjoint if they have no elements in common.
- Day 55: Given 2 integer arrays X and Y of same size. Consider both arrays as vectors and print the sum of maximum scalar product (Dot product) of 2 vectors.
- Day 56: Program to find whether the numbers of an array be made equal.
- Day 57: PASS or FAIL
- Day 58: Bucket Filling: Nejiya has a bucket having a capacity of K liters. It is already filled with X liters of water.Find the maximum amount of extra water in liters that Nejiya can fill in the bucket without overflowing.
- Day 59: Body Mass Index: You are given the height H (in metres) and mass M (in kilograms) of Anusree. The Body Mass Index (BMI) of a person is computed as M/H^2.
- Day 60: Good Weather: The weather report of Magicland is Good if the number of sunny days in a week is strictly greater than the number of rainy days.Given 7 integers A1,A2,A3,A4,A5,A6,A7 where Ai=1 denotes that the ith day of week in Magicland is a sunny day, Ai=0 denotes that the ith day in Magicland is a rainy day. Determine if the weather report of Magicland is Good or not.
- Day 61: Chess Format: Given the time control of a chess match as a+b,determine which format of chess out of the given 4 it belongs to: Bullet, Blitz, Rapid or Classical.
- Day 62: Gold Mining: Anusree has decided to go to a gold mine along with N of his friends (thus, total N+1 people including Anusree go to the gold mine).The gold mine contains a total of X kg of gold. Every person has the capacity of carrying up atmost Y kg of gold.Will Anusree and his friends together be able to carry up all the gold from the gold mine assuming that they can go to the mine exactly once.
- Day 63: Balancing Weight: No play and eating all day makes your belly fat. This happened to Manish during the lockdown. His weight before the lockdown was w1 kg (measured on the most accurate hospital machine) and after M months of lockdown, when he measured his weight at home (on a regular scale, which can be inaccurate), he got the result that his weight was w2 kg (w2>w1).Scientific research in all growing kids shows that their weights increase by a value between x1 and x2 kg (inclusive) per month, but not necessarily the same value each month. Manish assumes that he is a growing kid. Tell him whether his home scale could be giving correct results.
- Day 64: Amit and Feedback: Lots of geeky customers visit our Amit's restaurant everyday. So, when asked to fill the feedback form, these customers represent the feedback using a binary string i.e a string that contains only characters '0' and '1'.Now since Amit is not that great in deciphering binary strings, he has decided the following criteria to classify the feedback as Good or Bad :If the string contains the substring "010" or "101", then the feedback is Good, else it is Bad. Note that, to be Good it is not necessary to have both of them as substring.So given some binary strings, you need to output whether according to the Amit, the strings are Good or Bad.
- Day 65: New Tablet: Ajinkya decided to buy a new tablet. His budget is B, so he cannot buy a tablet whose price is greater than B. Other than that, he only has one criterion — the area of the tablet's screen should be as large as possible. Of course, the screen of a tablet is always a rectangle.Ajinkya has visited some tablet shops and listed all of his options. In total, there are N available tablets, numbered 1 through N. For each valid i, the i-th tablet has width Wi, height Hi and price Pi.Help Ajinkya choose a tablet which he should buy and find the area of such a tablet's screen, or determine that he cannot buy any tablet.
- Day 66: Palindromic substrings: Anoop likes strings a lot but he likes palindromic strings more. Today, Anoop has two strings A and B, each consisting of lower case alphabets.Anoop is eager to know whether it is possible to choose some non empty strings s1 and s2 where s1 is a substring of A, s2 is a substring of B such that s1 + s2 is a palindromic string. Here '+' denotes the concatenation between the strings.
- Day 67: Bricks Breaking: For her next karate demonstration, Arunima will break some bricks.Arunima stacked three bricks on top of each other. Initially, their widths (from top to bottom) are W1,W2,W3.Arunima strength is S. Whenever she hits a stack of bricks, consider the largest k≥0 such that the sum of widths of the topmost k bricks does not exceed S; the topmost k bricks break and are removed from the stack. Before each hit, Arunima may also decide to reverse the current stack of bricks, with no cost.Find the minimum number of hits Arunima needs in order to break all bricks if she performs the reversals optimally. You are not required to minimize the number of reversals.
- Day 68: You will be given queries. Each query is of one of the following three types: Add an element to the set, Delete an element from the set. (If the number is not present in the set, then do nothing), If the number is present in the set, then print "Yes"(without quotes) else print "No"(without quotes).
- Day 69: Suppose, we have a class A which is the base class and we have a class B which is derived from class A and we have a class C which is derived from class B, we can access the functions of both class A and class B by creating an object for class C.Hence, this mechanism is called multi-level inheritance. (B inherits A and C inherits B).Create a class called Equilateral which inherits from Isosceles and should have a function such that the output is as given below.
- Day 70: Given an array, rotate the array by one position in clock-wise direction.
- Day 71: There are N students in a class, where the i-th student has a score of Ai?.The i-th student will boast if and only if the number of students scoring less than or equal Ai? is greater than the number of students scoring greater than Ai?.Find the number of students who will boast.
- Day 72: Implement a simple editor. The editor maintains the content of a string S and have two following functions: "+ i x": insert a string x into the current string S after the i'th character of the S (we use 1-indexing in this problem). When i equals to 0 it mean we add x at the beginning of S. "? i len": Print the sub-string of length len starting at position i'th of S.At the beginning, the editor holds an empty string. There will be Q queries of the two types described above.
- Day 73: A string is called boring if all the characters of the string are same.You are given a string S of length N, consisting of lowercase english alphabets. Find the length of the longest boring substring of S which occurs more than once.Note that if there is no boring substring which occurs more than once in S, the answer will be 00.A substring is obtained by deleting some (possibly zero) elements from the beginning of the string and some (possibly zero) elements from the end of the string.
- Day 74: You have a grid with N rows and M columns. You have two types of tiles — one of dimensions 2×2 and the other of dimensions 1×1. You want to cover the grid using these two types of tiles in such a way that: Each cell of the grid is covered by exactly one tile; and The number of 1×1 tiles used is minimized.Find the minimum number of 1×1 tiles you have to use to fill the grid.
- Day 75: You are a person who is always fond of eating candies. Your friend gave you a candy of length N, to eat during the break period of your school.You start eating this candy from one of the ends. But as it is not your candy, your friend told you to eat exactly K unit length of candy during each bite. You will stop eating if the candy's length becomes 00. This means that you have eaten the entire candy.If at some point of time, the candy's length is positive, but less than K, you cannot take a bite thereafter.Can you eat the complete candy? If yes, print the number bites it will take, else print −1−1.
- Day 76: You are given N integers. In each step you can choose some K of the remaining numbers and delete them, if the following condition holds: Let the K numbers you've chosen be a1, a2, a3, ..., aK in sorted order. Then, for each i ≤ K - 1, ai+1 must be greater than or equal to ai * C.You are asked to calculate the maximum number of steps you can possibly make.
- Day 77: You are given an array A of N elements. For any ordered triplet (i,j,k) such that i, j, and k are pairwise distinct and 1≤i,j,k≤N, the value of this triplet is (Ai?−Aj?)⋅Ak?. You need to find the maximum value among all possible ordered triplets.Note: Two ordered triplets (a,b,c) and (d,e,f) are only equal when a=d and b=e and c=f. As an example, (1,2,3) and (2,3,1) are two different ordered triplets.
- Day 78: For a given array B1?,B2?,…,BM? of length at least 3, let's define its weight as the largest value of (Bi?−Bj?)⋅(Bj?−Bk?) over all possible triples (i,j,k) with 1≤i,j,k≤M and i!=j, j!=k, k!=i.You are given a sorted array A1?,A2?,…,AN? (that is, A1?≤A2?≤…≤AN?).Calculate the sum of weights of all contiguous subarrays of A of length at least 3. That is, count the sum of weights of arrays [Ai?,Ai+1?,…,Aj?] over all 1≤i< j≤N with j−i≥2.
- Day 79: You are given a binary string S of length N. You can perform the following operation on S:Pick any set of indices such that no two picked indices are adjacent.Flip the values at the picked indices (i.e. change 0 to 1 and 1 to 0).For example, consider the string S=1101101.If we pick the indices {1,3,6}, then after flipping the values at picked indices, we will get 1?10?110?1→0111111.Note that we cannot pick the set {2,3,5} since 2 and 3 are adjacent indices.Find the minimum number of operations required to convert all the characters of S to 0.
- Day 80: Alice and Bob went to a pet store. There are N animals in the store where the ith animal is of type Ai?.Alice decides to buy some of these N animals. Bob decides that he will buy all the animals left in the store after Alice has made the purchase.Find out whether it is possible that Alice and Bob end up with exactly same multiset of animals.
- Day 81: You have a binary string S of length N. In one operation you can select a substring of S and reverse it. For example, on reversing the substring [2,4]S[2,4] for S=11000, we change 11000→10010.Find the minimum number of operations required to sort this binary string.It can be proven that the string can always be sorted using the above operation finite number of times.
- Day 82: You are given N binary strings of length N each. You need to find a binary string of length N which is different from all of the given strings.Note:A binary string is defined as a string consisting only of '0' and '1'.A string is considered different from another string when they have different lengths, or when they differ in at least one position.
- Day 83: Given a complete binary tree with the height of H, we index the nodes respectively top-down and left-right from 1. The i-th node stores a positive integer Vi. Define Pi as follows: Pi=Vi if the i-th node is a leaf, otherwise Pi=max(Vi*PL, Vi*PR), where L and R are the indices of the left and right children of i, respectively. Your task is to caculate the value of P1.
- Day 84: 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.
- Day 85: You are given an undirected graph with N nodes (numbered 1 through N) and M edges. Each edge connects two distinct nodes. However, there may be multiple edges connecting the same pairs of nodes, and they are considered to be distinct edges. A lowercase English letter is written in each node.You are also given a string S with length L. A beautiful path is a sequence of L−1 edges such that there is a sequence of L nodes with the following properties:for each valid i, the i-th edge connects the i-th and (i+1)-th of these nodes for each valid i, the i-th character of S is written in the i-th of these nodes. There are no other restrictions — a path may visit nodes or edges any number of times in any order.Determine the number of beautiful paths in the graph. Since the answer can be very large, compute it modulo (10^9)+7.
- Day 86: Mahesh got a beautiful array named A as a birthday gift from his beautiful girlfriend Namratha. There are N positive integers in that array. Mahesh loved the array so much that he started to spend a lot of time on it everyday. One day, he wrote down all possible subsets of the array. Then for each subset, he calculated the sum of elements in that subset and wrote it down on a paper. Unfortunately, Mahesh lost the beautiful array :(. He still has the paper on which he wrote all subset sums. Your task is to rebuild beautiful array A and help the couple stay happy :)
- Day 87: There are N stones in a pond, each having a value Ai? written on it. A frog is at stone 1 and wants to reach stone N. The frog can jump from a stone i to any stone j(j>i). Let d be the length of subarray (i.e. j−i+1), then the energy required for the jump is (d⋅Ai?)−Aj?. Find the minimum non-negative amount of energy required by the frog to reach the N-th stone.Note: It is possible that the total amount of energy required is negative, in that case, you should print the minimum non-negative value (i.e. 0).
- Day 88: Blobo2 is in his practical exam. The teacher gave him a permutation A of N integers.The teacher has allowed Blobo2 to make a certain type of operation on the permutation. In one operation, he can: Apply left shift on the permutation. In other words, he can take the first element of the permutation and move it to the back of the permutation.The teacher has asked Blobo2 to find the lexicographically smallest permutation possible after applying any (possibly zero) number of given operations.Since Blobo2 wants to impress his teacher, he decided to perform at most two swaps in addition to the allowed operation.Find the lexicographically smallest possible permutation Blobo2 can generate after applying at most two swaps and any number of given operations.
- Day 89: You are given N integers. In each step you can choose some K of the remaining numbers and delete them, if the following condition holds: Let the K numbers you've chosen be a1, a2, a3, ..., aK in sorted order. Then, for each i ≤ K - 1, ai+1 must be greater than or equal to ai*C.You are asked to calculate the maximum number of steps you can possibly make.
- Day 90: Gru has a string S of length N, consisting of only characters a and b for banana and P points to spend.Now Gru wants to replace and/or re-arrange characters of this given string to get the lexicographically smallest string possible. For this, he can perform the following two operations any number of times.Swap any two characters in the string. This operation costs 11point. (any two, need not be adjacent).Replace a character in the string with any other lower case english letter. This operation costs 2 points.Help Gru in obtaining the lexicographically smallest string possible, by using at most P points.
- Day 91: Sridhar was a seasoned traveler. He liked to visit new places. More than all he was a meticulous planner. This time he was planning to visit Europe. He wrote down his travel itinerary like as follows:If he wanted to visit Madrid, Paris, Munich, Warsaw and Kiev in this order, he would write it down like as:Madrid Paris 100, Paris Munich 200, Munich Warsaw 150, Warsaw Kiev 120 More formally, if he wanted to go from A to B directly and the price is C dollars, then he would write A B C on a card. Each move was written on a different card. Sridhar was a great planner, so he would never visit the same place twice. Just before starting his journey, the cards got shuffled. Help Sridhar figure out the actual order of the cards and the total cost of his journey.
- Day 92: Let X be the set of all integers between 0 and n-1. Suppose we have a collection S1, S2, ..., Sm of subsets of X. Say an atom A is a subset of X such that for each Si we have either A is a subset of Si or A and Si do not have any common elements.Your task is to find a collection A1, ..., Ak of atoms such that every item in X is in some Ai and no two Ai, Aj with i ≠ j share a common item. Surely such a collection exists as we could create a single set {x} for each x in X. A more interesting question is to minimize k, the number of atoms.
- Day 93: After IOI Ilya decided to make a business. He found a social network called "TheScorpyBook.com". It currently has N registered users. As in any social network two users can be friends. Ilya wants the world to be as connected as possible, so he wants to suggest friendship to some pairs of users. He will suggest user u to have a friendship with user v if they are not friends yet and there is a user w who is friends of both of them. Note that u, v and w are different users. Ilya is too busy with IPO these days, so he asks you to count how many friendship suggestions he has to send over his social network.
- Day 94: Kekocity's population consist of N gnomes numbered with unique ids from 1 to N. As they are very joyful gnomes, they usually send jokes to their friends right after they get any (even if they knew it before) via their social network named as Mybeard. Mybeard became popular in the city because of message auto-deletion. It takes exactly one minute to read and resend joke to mates.Mayor of Kekocity, Mr. Shaikhinidin, is interested in understanding how the jokes are spread. He gives you database of Mybeardsocial network, and wants you to answer some queries on it. You will be given a list of friends for every gnome and M queries of the following type:Who will receive a message with joke after exactly K minutes, if the creator of joke was gnome with id x?
- Day 95: Kulyash is given an integer N. His task is to break N into some number of (integer) powers of 2. To achieve this, he can perform the following operation several times (possibly, zero): Choose an integer X which healready has, and break X into 2 integer parts (Y and Z) such that X=Y+Z. Find the minimum number of operations required by Kulyash to accomplish his task.
- Day 96: Akhil has many balls of white and black colors. One day, he was playing with them. During the play, he arranged the balls into two rows both consisting of N number of balls. These two rows of balls are given to you in the form of strings X, Y. Both these string consist of 'W' and 'B', where 'W' denotes a white colored ball and 'B' a black colored. Other than these two rows of balls, Akhil has an infinite supply of extra balls of each color. he wants to create another row of N balls, Z in such a way that the sum of hamming distance between X and Z, and hamming distance between Y and Z is maximized. Hamming Distance between two strings X and Y is defined as the number of positions where the color of balls in row X differs from the row Y ball at that position. e.g. hamming distance between "WBB", "BWB" is 2, as at position 1 and 2, corresponding colors in the two strings differ. As there can be multiple such arrangements of row Z, Akhil wants you to find the lexicographically smallest arrangement which will maximize the above value.
- Day 97: Arun has a rooted tree of N vertices rooted at vertex 1. Each vertex can either be coloured black or white. Initially, the vertices are coloured A1?,A2?,…AN?, where Ai? € {0,1} denotes the colour of the i-th vertex (here 0 represents white and 1 represents black). He wants to perform some operations to change the colouring of the vertices to B1?,B2?,…BN? respectively. Arun can perform the following operation any number of times. In one operation, he can choose any subtree and either paint all its vertices white or all its vertices black. Help Arun find the minimum number of operations required to change the colouring of the vertices to B1?,B2?,…BN? respectively.
- Day 98: There are N breakfasts in the restaurant “Fat Hut” where the Arun works. The ith breakfast has an attractiveness Ai? and cost Ci?. Arun has noticed that nobody takes the jth breakfast if there exists at least one breakfast i such that Ai?≥Aj? and Ci?< Cj?. In other words, if a breakfast is less attractive and more expensive than any of the other dishes, then nobody is interested in that breakfast. Arun will be happy if all the N breakfasts have a chance to be taken. Unfortunately, Arun has no power over prices. On the other hand, he can change the attractiveness of some breakfasts by some real number. However, after the changes, the attractiveness of the ith breakfast must lie in the interval [Li?,Ri?]. He would also like to change the attractiveness of theminimum number of breakfasts. Help the Chef do it.
- Day 99: There is a hallway of length N−1 and you have M workers to clean the floor. Each worker is responsible for segment [Li?,Ri?], i.e., the segment starting at Li? and endingat Ri?. The segments might overlap. Every unit of length of the floor should be cleaned by at least one worker. A worker can clean 1 unit of length of the floor in 1 unit of time and can start from any position within their segment. A worker can also choose to move in any direction. However, the flow of each worker should be continuous, i.e, they can’t skip any portion and jump to the next one, though they can change their direction. What’s the minimum amount of time required to clean the floor,if the workers work simultaneously?
- Day 100: You have prepared four problems. The difficulty levels of the problems are A1?,A2?,A3?,A4? respectively. A problem set comprises at least two problems and no two problems in a problem set should have the same difficulty level. A problem can belong to at most one problem set. Find the maximum number of problem sets you can create using the four problems.