Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last updated: Aug 7, 2022

Beginners Level

Welcome to the beginner-level ninja training for competitive programming, this section covers the topics that'll you expect a beginner to solve in the field of competitive programming, this is an interesting journey for a rookie competitive programmer, as you'll be challenged by the problems here, so just try to solve them on your own and if you get stuck, just remember we're always there to help.
Setup for competitive programming
In this article, we will understand how to do the complete Setup for doing Competitive Programming in the c++ language in the local machine.
Author Apoorv
3 upvotes
Boilerplate Competitive programming
This blog will discuss the boilerplate used for competitive programming.
Important tools to boost performance during contests
This article discusses the important tools to boost performance in contests.
Next Permutation
In this blog, we'll be discussing different approaches for solving one of the classic interview problems, i.e., Next Permutation.
Next Permutation
This article will brief you on implementing the next permutation of a number.
Single Number
In this blog, we’ll learn to find a single number from an array of elements where every element appears twice except one.
Suffix Array Optimal Construction HARD
In this article, we will discuss two approaches to construct a suffix array in java.
Intersection of Two Arrays
This blog will discuss how we can solve the problem ‘Intersection of two arrays’.
Sliding Window
In this blog, we will be discussing the famous sliding window technique, how it is more efficient than the naive approach, and its time and space complexity.
Divide the Chocolate
In this blog, we will cover the Divide the Chocolate question and discuss Time and Space complexity.
Car Pooling MEDIUM
In this blog, we will discuss Leetcode problem - Carpooling with brute-force in an optimized manner along with the space and time complexity.
Author Yogi21
0 upvotes
Sort an Array of 0s,1s and 2s
This article discusses the different approaches to sort the array containing 0s,1s, and 2s, starting with the approach which is similar to the approach in the Dutch national flag problem and then an intuitive approach that simply maintains the count and finally stores it in the correct place.
Minimum coverage by heaters
This blog finds the minimum heaters range so it can warm all the houses.
Longest Common Prefix from Suffix Array MEDIUM
In this article, we will be discussing the two approaches to finding the longest common prefix of two substrings of a given string from the suffix array.
Next Greater and Smaller Element for Every Element in an Array MEDIUM
The program to find the next greater and smaller element for every element in an array is common in coding interviews. Its solution is discussed in this article.
How To Find The Kth Smallest Element In An Array? MEDIUM
Learn how to find the kth smallest element in an array using min heaps or sets. These algorithms are efficient and can be used on arrays of any size. Keep reading!
K’th Largest Element in an Array MEDIUM
Find the kth largest element in an array using various approaches, such as sorting, heap, and quick select. Learn how to implement these algorithms in C++, Java, and Python. Read on!
Find Smallest Missing Positive Integer MEDIUM
In this blog, we will be discussing four different approaches to finding the smallest missing positive integer in an unsorted array.
Find all triplets with zero-sum
This blog discusses the approach to find all triplets in an array of both positive and negative with zero-sum
Find all elements in an array which have at-least two greater elements. EASY
In this article, we will discuss how to find all elements in an array that have at-least two greater elements and understand the concept with examples in detail.
Find Index of 0 to be replaced with 1 to get the Longest Continuous Sequence of 1s in a Binary Array MEDIUM
This article discusses a DSA problem of specifically finding the index of 0 in a binary array that should be replaced with 1 to get the most extended sequence of continuous ones.
Two Best Non-Overlapping Events
In this blog, we will discuss a problem involving binary search and a tricky construction. We will learn a tricky construction that proves to be very useful to solve problems based on intervals.
Binary Subarrays with Sum MEDIUM
This article discusses the Binary Subarrays with Sum along with different approaches followed by the Implementation in C++, Python, and Java.
Hotel Bookings Possible
In this blog, we are going to discuss the problem of Hotel Bookings Possible. This is the most frequently asked problem in almost all tech interviews.
Find the sum of elements less than A and greater than B in an array
This article discusses the different approaches to finding the sum of elements less than A and greater than B in an array with examples and its C++ code.
Author Spider
0 upvotes
Print Next Greater Number of Q Queries MEDIUM
In this blog, we will learn the logic of how to print the next greater number of q queries and see how to implement the logic in c++.
Check if reversing a sub-array make the array sorted MEDIUM
In the blog, we will discuss the problem of checking if there exists a subarray that, when reversed, makes the whole array sorted.
Smallest Difference Triplet from Three arrays MEDIUM
This blog will give you detailed explanation and implementation of the approach to find the Smallest Difference Triplet from Three arrays
Suffix Array Construction (Brute Force N ^ 2 LogN)
This article explains the concept of suffix arrays and explains the naive algorithm for suffix array construction.
Rearrange Positive and Negative Numbers With Constant Extra Space | Part 1
This blog mainly focuses on the problem, namely, Rearrange Positive and Negative Numbers With Constant Extra Space. We will discuss different approaches to solve this problem with a proper explanation and flow diagram.
Minimum Number of Subsets with Distinct Elements EASY
In this article, we will look into an important coding question, Minimum number of subsets with distinct elements.
Find the first, second, and third minimum elements in an array EASY
In this blog, you will learn about the problem of finding the first three minimum elements in an array. We will go over various approaches to solve this problem.
Find an array element such that all elements are divisible by it EASY
In this blog, you will learn about the problem of finding an array element such that all elements are divisible by it. We will go over various approaches to solve this problem.
Count of Subarrays in the Range [L, R] having XOR + 1 equal to XOR (XOR) 1 for M Queries MEDIUM
In this blog, we’ll solve a fascinating problem Count of subarrays in the range [L, R] having XOR + 1 equal to XOR (XOR) 1 for M queries using parity.
Count Different Substrings in a String
This article will cover the implementation and approach of computing the different substrings in a string.
Count Divisible Pairs in an Array
In this blog, we will discuss count divisible pairs in an array problem. We will also discuss the algorithm and the implementation for the problem using hashmap in different languages.
Product of maximum in first array and minimum in second EASY
In this blog, we will discuss different approaches to multiple the maximum element of the first array to the minimum element of the second array. Then we will discuss their algorithms, pseudo-codes, and complexities analysis.
Find the sum of all the distinct elements in an array EASY
In this article, we will discuss the problem of finding the sum of all distinct elements in an array.
Find maximum average subarray of length k EASY
In this blog, we will discuss the approach to find the maximum average subarray of an array of length ‘k’.
Tandem EASY
In this article, we will solve one of the popular problems, Tandem.
Good Substrings
This article will discuss the solution for the problem statement "count of Good Substrings," in which we have to find the total number of good substrings in a given string. The article has discussed both the brute force approach and the optimized approach. Along with the solution, the article focuses on the time and space complexity of the solution.
Substrings and Frequency
In this blog, we will learn to solve a problem based on the suffix array.
Find Element at Given Index After Several Rotations
We will write a program to find the element at the given index after several Rotations.
Count triplets with sum smaller than a given value
In this article, we will discuss the counting of triplets with a sum less than the given value. We will also look at the problem statement in detail, followed by its various approaches, code, and complexities.
The Suffix Matches
In this article, we will learn how to find the longest matching suffix.
Ada String
This article describes how to find the number of distinct substrings beginning with each letter.
Double the first element and move zero to the end
In this blog, we will discuss the approach to double the first element and move zeros to the end.
Design Parking System EASY
This article thoroughly discusses the Design Parking System using various examples, explanations, and codes.
Replace two consecutive equal values with one greater value EASY
In this blog, we will discuss the approach to replace two consecutive equal values with one greater value in an array.
Check If a Number is Not a Power of 2 EASY
This blog will discuss different ways to check whether a number is not a power of 2.
Rat in a Maze HARD
This article we will discuss the classic backtracking problem called Rat in a Maze. We will look at the problem statement in detail followed by the algorithm and implementation in C++.
Word Search HARD
In this blog, we’ll discuss a really important problem: Word Search. We are also going to discuss the time and space complexities of the approaches covered.
Valid Sudoku HARD
This is part two of the Sudoku Solver article. In this article, we will discuss whether the given sudoku is valid or not.
Power Set EASY
In this blog, we will discuss one of the most asked questions in coding interviews, i.e., power set. We will look at all possible approaches to the given problem.
Sort a Given Array by Swapping Only Pairs with GCD as 1 MEDIUM
This blog check whether sorting a given array by swapping only pairs with GCD as 1 is possible or not. Read the blog to learn the method in detail.
Count of all unique paths from given source to destination in a Matrix EASY
This article will discuss to return the count of all unique paths from a given source to a destination in a Matrix and the approach to solve this problem.
C++ Program To Print All Permutations Of A Given String EASY
This article will discuss printing all the permutations of a given string and the approach to solve this problem in C++ language.
Maximize Cost of Forming a Set of Words Using Given Set of Characters EASY
In this blog, we will see how we can solve the famous problem ‘Maximize Cost of Forming a Set of Words Using a Given Set of Characters’.
Print all unique paths from a given source to destination in a Matrix moving only down or right MEDIUM
This article will brief you on the problem to Print all unique paths from a given source to destination in a Matrix moving only down or right.
Print All Paths from a Source Point to All the 4 Corners of a Matrix HARD
In this article, we will solve a problem using recursion and backtracking that can be asked in the interviews.
Print all Paths to Escape Out of a Matrix using K Moves HARD
In this blog, we’ll be solving a backtracking question on matrix, ‘Print all paths to escape out of a matrix using K moves.’
Sum of all the subsets whose sum is a Perfect Number from a given array MEDIUM
This article discusses how to calculate the sum of all the subsets whose sum is a Perfect Number from a given array with a complete explanation and its C++ code.
Author Spider
0 upvotes
Minimize operations to transform A to B by multiplying by 2 or appending 1 to it MEDIUM
This article will brief you to Minimize operations to transform A to B by multiplying by 2 or appending 1 to it.
Implement Hamiltonian Cycle HARD
In this article, we will discuss the problem of printing the hamiltonian cycle for the given graph
The K-th Lexicographical String of All Happy Strings of Length ‘N’ HARD
In this blog, we will discuss the problem to find the K-th lexicographical string of all happy strings of length ‘N.’
Determine the longest path from the source cell to the destination cell in a matrix
In this article, we will learn how to determine the longest path from the source cell to the destination cell in a 2D matrix.
M Coloring Problem MEDIUM
In this article, we'll discuss one of the basic problems of graph theory i.e. m-coloring problem along with its implementation in different languages.
Print all the Balanced Brackets Strings that can be formed by replacing '?' in string
This article will discuss the solution to Print all the Balanced Brackets Strings that can be formed by replacing '?' in a string. Along with the solution, the article focuses on the time and space complexity of the solution.
Maximum length of a string having even frequency of each character formed by concatenation
This article will discuss the problem "Maximum length of a string having even frequency of each character formed by concatenation," the solution approach to this problem, its C++ implementation, and its time and space complexity.
Author Riya
1 upvote
Arrange Elements of Given Array in a Mathematical Expression using Operators [+, -, *, /] and Parentheses to Get Value 28
Elements of a given array are to be arranged in an array using operators [+, -, *, /] and parenthesis to obtain the value of 28.
Solve Sudoku on the Basis of the Given Irregular Regions
In this article, we will learn how to solve the sudoku puzzle on the basis of the given irregular regions.
Permutations of a Given Number That are Powers of 2
This article will cover the problem of finding the permutations of a given number in which digits are the perfect power of 2.
Least count of words required to construct a target String
This article will brief you on finding the least count of words required to construct a target String.
Path exists in the matrix with the addition of element is at most K.
This article will brief you to Check if a path exists in the matrix with the addition of element is at most K.
Generate all possible combinations of K numbers that sum to N MEDIUM
This blog finds all possible combinations of K numbers that sum to N. Read the blog to learn the problem's implementation in detail.
Fast Fourier Transform for polynomial multiplication
This article explains the idea of fast fourier transform for polynomial multiplication.
Fibonacci numbers
This blog covers the concepts of fibonacci numbers, the matrix multiplication in fibonacci numbers and the golden ratio approach to find the Nth fibonacci number.
Finding Repetitions MEDIUM
This article incorporates information about the problem finding repetitions and how to implement this problem by the Main-Lorentz algorithm.
Tiling Problem Using Divide and Conquer Algorithm MEDIUM
In this article, we will discuss the popular tiling problem and an approach to how to solve it using a divide and conquer algorithm with the implementation in C++, Java, and Python.
Check if a number is a palindrome or not without using any extra space EASY
This article tells us how to check whether a number is a palindrome in O(1) space complexity.
Check if the array can be split into subarrays such that the XOR of the length of the Longest Decreasing Subsequences of those subarrays is 0
In this article, we will discuss the problem to check if the array can be split into subarrays such that the XOR of the length of the Longest Decreasing Subsequences of those subarrays is 0
Count Pairs (i, j) From a Given Array Such that ARR[i] > K * ARR[j] EASY
This blog will discuss how we can solve one of the most asked problems based on merge sort, i.e., count pairs (i, j) from a given array such that ARR[i] > K * ARR[j].
Count the number of inversions in an array using merge sort
This article discusses the approach to count the number of inversions in an array using merge sort with its C++ code.
Author Spider
0 upvotes
Reduce array to longest sorted array possible by removing either half of given array in each operation
This article will discuss to reduce the array to the longest sorted array possible by removing either half of the given array in each operation and the way to solve this problem.
Scramble string MEDIUM
In this article, we’ll learn how to solve the scramble string problem.
Koko Eating Bananas MEDIUM
In this blog, we will solve one of the problems of the Leetcode in a naive approach to optimized one.
Author Yogi21
0 upvotes
Count Negative Numbers in a Sorted Matrix EASY
This blog discusses how to count the number of negative numbers in the sorted grid.
Merge two sorted arrays in O(1) extra space using QuickSort partition
This article will brief you on how to Merge two sorted arrays in O(1) extra space using QuickSort partition.
Longest Substring with At Least K Repeating Characters
This article will brief you on finding the Longest Substring with At Least K Repeating Characters.
How to find the minimum capacity of the ship to ship packages within d days.
This blog focuses on the solution to the problem of finding the minimum capacity of the ship to ship packages in d days. Read further to learn the detailed solution.
Median of Two Sorted Arrays
The blog discusses in detail the median of two sorted arrays. We’ll discuss many approaches to solve the problem along with time and space complexity for each method.
Author Zenith
0 upvotes
Longest Common Prefix using Divide and Conquer Algorithm
In this article, we will learn how to find Longest Common Prefix using the Divide and Conquer Algorithm.
Check if a Substring Exists, having Only Two Distinct Characters with The Frequency of One as Twice The Others EASY
Arrays and String are widely asked topics in coding interviews. This article will look at a problem involving arrays and strings.
Manacher’s Algorithm EASY
In this article, we will study how to find all the substrings that are palindromes using Manacher’s Algorithm. We will also discuss the space and the time complexity of our solution.
Count of Increasing Substrings in given String MEDIUM
This blog will cover the problem of counting the number of increasing substrings in a string.
Print all subsequences of a string
In this article, we will discuss how to print all subsequences of a string.
Maximize the Confusion of an Exam
In this blog, we will discuss an exciting problem, namely “Maximize the confusion of an Exam”. It is an ad-hoc problem.
Minimizing the count of a subsequence of a given binary string such that any subsequence doesn’t contain adjacent zeroes or ones
This article will discuss the problem of finding the minimum number of subsequences of a given binary string such that any subsequence doesn’t contain adjacent zeroes or ones.
Count of All Substrings in a Binary String in Which Count of 1’s is Strictly More than the Count of 0’s HARD
This blog will discuss the problem of counting the substrings in a binary string that contains more 1s than 0s.
Find the longest substring in a binary string with an equal count of 0s and 1s
In this article, we will learn to find the longest substring in a string containing only 0s and 1s with an equal count of 0s and 1s.
Check if Count of 1s can be Made Greater in a Binary string by Changing 0s Adjacent to 1s
In this blog, we will discuss a coding challenge that involves the use of sorting and greedy algorithms. Greedy algorithms are well known for their simplicity and ease to understand.
Find the Length of Smallest Non-Prime Subsequence in a Numeric String
In this article, we will solve a programming problem where we need to design an algorithm to find the length of the smallest non-prime subsequence in a given numeric string.
The Largest Prime Number Possible from a Subsequence of a Binary String MEDIUM
The following article discusses how to find the largest prime number formed from the subsequence of the given Binary String along with its implementation in C++, Java, and Python.
Compute the Count of K Length Subarrays Containing Only 1s in Binary String
This article will give you an overview of the implementation of subarrays related problems through Computing the Count of K Length Subarrays Containing Only 1’s in Given Binary String.
Find the Kth lexicographically smallest string with unique products for all the substrings
In this article, we will learn to find the Kth lexicographically smallest string of integers of length N such that each substring's products should be unique.
Compare Version Numbers MEDIUM
This blog will discuss, how can we compare two different version numbers. We will look at the implementation in different languages.
Count and Say MEDIUM
In this blog, we will discuss recursive and iterative solutions to the problem count and say.
Ninja and his Strings
This article will discuss the problem “Ninja and his strings”, solution approach to the problem, its C++ implementation, and its time and space complexities.
String Hashing
In this blog, we will learn what string hashing is and how it is helpful in comparing two strings efficiently.
Maximize the Confusion of an Exam
In this blog, we will discuss an exciting problem, namely “Maximize the confusion of an Exam”. It is an ad-hoc problem.
Prefix function - Knuth-Morris-Pratt Algorithm
In this article, we will learn Knuth-Morris-Pratt or KMP Algorithm.
Lexicographically largest String after removal of K characters
This article covers the approach to the problem lexicographically largest string after removing k characters and its implementation in C++.
Author Spider
0 upvotes
Find All Words in the Given Sentence that are Lexicographically Increasing and Lexicographically Decreasing
This blog will discuss how we can solve the problem find all words in the given sentence that are lexicographically increasing and lexicographically decreasing.
Minimum Count of Inversion Pairs Possible by Concatenating N Binary Strings in any Order
In this blog, we will learn to solve a problem based on sorting. We will discuss the problem minimum count of inversion pairs possible by concatenating ‘N’ binary strings in any order.
Bitwise Operators in C/C++ EASY
This article discusses the types of Bitwise Operators in C/C++ and their use.
Bit Manipulation for Competitive Programming EASY
This article discusses Bit Manipulation for Competitive Programming with examples. You will learn the representation of decimal numbers in binary and binary operators.
Total Hamming Distance
This article will brief you about the hamming distance between two integers is the number of positions where the corresponding bits will be different.
Hamming Distance
This article discusses the problem of Hamming Distance, where we have to calculate the hamming distance between two integers.
Ugly Numbers 2
This article discusses the problem of Ugly Numbers 2, where we have to find the nth ugly number.
Author
1 upvote
Find Elements
In this blog, we will discuss a famous interview coding question, “Find Elements” and its various solutions.
Bitwise AND of Numbers Range
This blog will discuss the different ways to solve the problem of bitwise AND of Numbers Range, subsequently discussing the time and space complexity.
Longest Consecutive Sequence of 1’s in the Binary Representation of a Number
In this blog post, we’ll study one easy problem from the topic of data structures: finding the longest consecutive sequence of 1’s in the binary representation of a number.
Minimum X (xor) A
In this article, we will learn about the problem Minimum X (xor) A and solve how to find the value of X for which X xor A is the minimum, and X should satisfy the given condition.
Lucky Alive Person in a Circle MEDIUM
This blog will help you build logic for one of the famous puzzles Lucky Alive Person in a Circle, and its implementation in C++, Java, and Python.
Count Number of Set Bits in an Integer EASY
Count the total number of set bits in a given integer using a simple and efficient algorithm. Learn how to count set bits in Python, C++, and Java.
Gray Code
This article will introduce Gray Code and give an introduction to Gray Code and will provide approaches to use it in different data structure problems.
Number of Steps to Reduce a Number in Binary Representation to One
In this, we will discuss the problem i.e number of steps to reduce a number to one and its approach to code.
Divide Two Integers
This blog will discuss the problem of divide two integers and solve it using different approaches focusing on the time and space of each approach.
Binary Numbers of N digits
This article discusses the Problem of printing all Binary Numbers of N digits
Generate All Binary Numbers in the Range [L, R]
In this blog, we’ll use a simple loop and bit knowledge on the length of a decimal number to solve the problem, ‘Generate all binary numbers in the range [L, R]’.
Find a Number X Such that XOR of Given Array after Adding X to Each Element is 0
In this article, we will solve a bit manipulation problem that will help you to get a good grasp on bits.
Count of Subsets having Maximum Possible XOR Value MEDIUM
In this blog, we will solve an interesting coding challenge using dynamic programming and the gaussian elimination technique. Dynamic Programming and XOR operation are well-known topics asked in coding interviews.
Convert given binary to its equivalent ASCII character string MEDIUM
In this article, we will learn how to convert a given binary string to its equivalent ASCII character string
Count Set Bits in Index Range [L, R] in Given Array for Q Queries
In this article, we will learn how to count set bits in index range [L, R] in the given Array for Q queries.
Count Total Set Bits in an Array EASY
In this blog, we will discuss solving the problem of counting total set bits in an array.
Form a Number Using Bit Rotations of N having the Same Frequency of each Digit
This article will cover the approach and implementation of the problem- Form a Number Using Bit Rotations of N having the Same Frequency of each Digit.
Maximize Bitwise AND of the array by replacing at most one element
This article will discuss the problem to maximize bitwise AND of the array by replacing at most one element
Bit Stuffing and Bit Destuffing MEDIUM
In the following blog, we discuss the bit stuffing and bit de-stuffing problems using one of the most intuitive yet optimal approaches involving elementary logic and understanding of loops.
Space optimization using bit manipulations
This article explains how space optimization works and how to perform space optimization using the bit manipulation technique.
Find the maximum product of Bitwise AND and Bitwise OR of K-size subarray
This article will discuss the problem to find the maximum product of Bitwise AND and Bitwise OR of K-size subarray
Find the size of the largest subset with bitwise AND greater than their bitwise XOR
The blog aims to find the size of the largest subset whose bitwise AND is greater than its bitwise XOR and explains the process of how to reach the solution.
Find the total number of subsequences having odd Bitwise AND values in the array
This article explains how to determine the total number of subsequences having odd bitwise and values in the array.
Find the total number of subsequences having odd Bitwise OR values in the array
This article explains how to determine the total number of subsequences having odd bitwise OR values in the array.
Maximize sum of LSBs of Bitwise OR of all possible N/2 pairs from given Array
The blog aims to find the maximum sum of LSBs of Bitwise OR of all possible N/2 pairs from the given Array.
Find the next greater number formed with exactly two unique digits for each array element
This article describes how to find the next greater number formed with exactly two unique digits for each array element