Skip to content

patelsneh18/cpp-competitive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 

Repository files navigation

cpp-competitive

Includes Problems Solved from Various Resources

Arrays 💨

Problem 1: Given a binary array A[] of size N. The task is to arrange the array in increasing order. Note: The binary array contains only 0 and 1. Time Complexity - O(N)

Problem 2: Print Reverse/Palindrome of Given Array

Problem 3: Given an array of even size N, task is to find minimum value that can be added to an element so that array become balanced. An array is balanced if the sum of the left half of the array elements is equal to the sum of right half.

Problem 4: Given an array arr[] of size N representing the size of candles which reduce by 1 unit each day.The room is illuminated using the given N candles. Find the maximum number of days the room is without darkness.

Problem 5: Given an array arr[] of size N, the task is to add the minimum number(should be greater than 0) to the array so that the sum of the array becomes even.

Problem 6: Given an array a[] of size N which contains elements from 0 to N-1, you need to find all the elements occurring more than once in the given array.

Problem 7: Given an array having both positive and negative integers. The task is to compute the length of the largest subarray with sum 0.

Problem 8: Given an array A of N positive numbers. The task is to find the first Equilibium Point in the array. Equilibrium Point in an array is a position such that the sum of elements before it is equal to the sum of elements after it. more...

Problem 9: Given an array A of integers. The task is to complete the function which returns an integer denoting the length of the longest sub-sequence such that elements in the sub-sequence are consecutive integers, the consecutive numbers can be in any order. more...

Problem 10: Write a program to print all the LEADERS in the array. An element is leader if it is greater than all the elements to its right side. And the rightmost element is always a leader. For example int the array {16, 17, 4, 3, 5, 2}, leaders are 17, 5 and 2. more...

Problem 11: You are given an array arr[] of N integers including 0. The task is to find the smallest positive number missing from the array. more...

Problem 12: You are given an array arr[] of N integers including 0. The task is to find the smallest positive number missing from the array. more...

Problem 13: Given an array A of N integers, find any 3 elements in it such that A[i] < A[j] < A[k] and i < j < k.Your task is to complete the function find3Numbers which finds any 3 elements in it such that A[i] < A[j] < A[k] and i < j < k. You need to return them as a vector/ArrayList/array (depending on the language cpp/Java/Python), if no such element is present then return the empty vector of size 0. more...

Problem 14: Complete the function countEleLessThanOrEqual() that takes two array arr1[], arr2[], m, and n as input and returns an array containing the required results(the count of elements less than or equal to it in arr2 for each element in arr1 where ith output represents the count for ith element in arr1.)more...

Problem 15: Given a matrix(2D array) M of size N*N consisting of 0s and 1s only. The task is to find the column with maximum number of 0s.more...

Problem 16: Given an array A of N elements. The task is to count number of even and odd elements in the array.more...

Problem 17: Given an array with repeated elements, the task is to find the maximum distance between two occurrences of an element.more...

Problem 18: Given an array A (may contain duplicates) of N elements and a positive integer K. The task is to count the number of elements which occurs exactly floor(N/K) times in the array.more...

Problem 19: 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, …more...

Problem 20: 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, …more...

Problem 21 - Maximum Index: Problem Link

Problem 22 - Maximum Index: Problem Link

Problem 23 - Maximum Sum in the Configuration: Problem Link

Problem 24 - Merge two Sorted Arrays: Problem Link

Problem 25 - Minimum number to form the sum even : Problem Link

Problem 26 - Stock Buy Sell : Problem Link

Problem 27 - Stock Buy Sell : Problem Link

About

Includes Problems Solved from Various Resources

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages