- Given are the heights of certain Buildings which lie adjacent to each other. Sunlight starts falling from the left side of the buildings. If there is a building of a certain Height, all the buildings to the right side of it having lesser heights cannot see the sun. The task is to find the total number of such buildings that receive sunlight.
- Given an even number N (greater than 2), return two prime numbers whose sum will be equal to given number. There are several combinations possible. Print only the pair whose minimum value is the smallest among all the minimum values of pairs.
- Given an unsorted array A of size N that contains only non-negative integers, find a continuous sub-array which adds to a given number S.
- Given a string str of lowercase ASCII characters, count the number of distinct continuous palindromic sub-strings which are present in the string str.
- Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … shows the first 11 ugly numbers.By convention, 1 is included. Write a program to find Nth Ugly Number.
- Given two expressions ex1 and ex2 in the form of strings. The task is to compare them and check if they are similar. Expressions consist of lowercase alphabets, '+', '-' and '( )'.
- Given an array of positive numbers, the task is to find the number of possible contiguous subarrays having product less than a given number k.
- Given two sorted arrays arr1[] of size N and arr2[] of size M. Each array is sorted in non-decreasing order. Merge the two arrays into one sorted array in non-decreasing order without using any extra space.
- Given the co-effecients of X,Y and Z in a system of simultaneous equations. Find the values of X,Y and Z.: a1X + b1Y + c1Z = d1, a2X + b2Y + c2Z = d2, a3X + b3Y + c3Z = d3
- Given an array in such a way that the elements stored in array are in increasing order initially and then after reaching to a peak element , elements stored are in decreasing order. Find the highest element. Note: A[i] != A[i+1]
-
Notifications
You must be signed in to change notification settings - Fork 0
i-am-stark/competitive_programming_snippets
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A few code snippets from my solved CP problems .
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published