Articles

Jun 28, 2025 Codeforces

Badge

In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of n students

Read more →
Jun 27, 2025 Codeforces

QAQ

QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth.

Read more →
Jun 27, 2025 Codechef

Mutated Minions

Gru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions' incapability.

Read more →
Jun 22, 2025 HackerRank

Postorder Traversal

Complete the function in the editor below. It received parameter: a pointer to the root of a binary tree. It must print the values in the tree's postorder.

Read more →
Jun 21, 2025 Leetcode

Nth Digit

Given an integer n, return the nth digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...].

Read more →
Jun 19, 2025 Codechef

Too many items

Chef bought N items from a shop. Although it is hard to carry all these items in hand, so Chef has to buy some polybags to store these items.

Read more →
Jun 18, 2025 Codeforces

Elections

Elections are taking place in Berland. There are n candidates participating in the elections, numbered from 1 to n

Read more →
Jun 17, 2025 Codechef

A or B

It is known that Chef requires X minutes to solve Problem A correctly and Y minutes to solve Problem B correctly.

Read more →
Jun 13, 2025 Leetcode

My Calendar I

You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking.

Read more →
Jun 11, 2025 Codeforces

Benches

There are n benches in the Berland Central park. It is known that a people are currently sitting on the bench

Read more →
Jun 10, 2025 Codechef

Chess Ratings

Alice has recently started playing Chess. Her current rating is X. She noticed that when she wins a game, her rating increases by 8 points.

Read more →
Jun 08, 2025 HackerRank

Print in Reverse

Given a pointer to the head of a singly-linked list, print each value from the reversed list. If the given list is empty, do not print anything.

Read more →
Jun 04, 2025 Leetcode

Maximum Binary Tree

You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the following algorithm.

Read more →
May 29, 2025 Codechef

Sasta Shark Tank

Devendra just had a million-dollar idea and he needs funds to startup. He was recently invited to Sasta Shark Tank (A TV show where entrepreneurs pitch.

Read more →
May 29, 2025 Leetcode

Delete Node in a BST

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.

Read more →
May 28, 2025 Hackathon

Number of cycles

You are given an N-sided regular polygon. You have connected the center of the polygon with all the vertices, thus dividing the polygon into N equal parts.

Read more →
May 27, 2025 Leetcode

Longest Univalue Path

Given the root of a binary tree, return the length of the longest path, where each node in the path has the same value. This path may or may not pass through.

Read more →
May 27, 2025 Codechef

Cup Finals

It is the World Cup Finals. Chef only finds a match interesting if the skill difference of the competing teams is less than or equal to D.

Read more →
May 23, 2025 Codeforces

Equator

Polycarp has created his own training plan to prepare for the programming contests. He will train for n days, all days are numbered from 1 to n beginning

Read more →
May 22, 2025 Codeforces

Find Amir

A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.

Read more →
May 21, 2025 Codechef

Fill Candies

Chef received N candies on his birthday. He wants to put these candies in some bags. A bag has K pockets and each pocket can hold at most M candies

Read more →
May 20, 2025 Codechef

Chefland Games

Each referee has to point out whether he considers the ball to be inside limits or outside limits. The ball is considered to be IN if and only if all the.

Read more →
May 19, 2025 HackerRank

Minimum Distances

The distance between two array values is the number of indices between them. Given , find the minimum distance between any pair of equal elements in the array.

Read more →
May 19, 2025 Codechef

The Lead Game

The game of billiards involves two players knocking 3 balls around on a green baize table. Well, there is more to it, but for our purposes this is sufficient.

Read more →
May 18, 2025 Codeforces

Diagonal Walking

Mikhail walks on a 2D plane. He can go either up or right. You are given a sequence of Mikhail's moves. He thinks that this sequence is too long and he wants.

Read more →
May 16, 2025 Leetcode

Path Sum

Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path.

Read more →
May 15, 2025 HackerRank

Service Lane

A driver is driving on the freeway. The check engine light of his vehicle is on, and the driver wants to get service immediately.

Read more →
May 13, 2025 HackerRank

Number Line Jumps

You are choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction.

Read more →
May 12, 2025 Leetcode

Permutations

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

Read more →
May 12, 2025 Codechef

Candy Distribution

Chef has N candies. He has to distribute them to exactly M of his friends such that each friend gets equal number of candies and each friend gets even num.

Read more →
May 07, 2025 HackerRank

Sales by Match

There is a large pile of socks that must be paired by color. Given an array of integers representing the color of each sock, determine how many pairs of socks.

Read more →
May 06, 2025 Leetcode

Jump Game

You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length.

Read more →
May 06, 2025 Codechef

Finding Square Roots

In olden days finding square roots seemed to be difficult but nowadays it can be easily done using in-built functions available across many languages

Read more →
May 04, 2025 Codechef

Finding Shoes

Chef has N friends. Chef promised that he would gift a pair of shoes (consisting of one left shoe and one right shoe) to each of his N friends

Read more →
May 02, 2025 HackerRank

Marc's Cakewalk

Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those calories.

Read more →
May 02, 2025 Codeforces

Diagonal Walking

Mikhail walks on a 2D plane. He can go either up or right. You are given a sequence of Mikhail's moves. He thinks that this sequence is too long and he wants.

Read more →
May 01, 2025 Codeforces

Fake NP

Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.

Read more →
May 01, 2025 Codechef

Discus Throw

In discus throw, a player is given 3 throws and the throw with the longest distance is regarded as their final score.

Read more →
Apr 26, 2025 Leetcode

Rotated Digits

An integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is different from x. Each digit must be rotated.

Read more →
Apr 24, 2025 Codeforces

3 Palindrome

In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.

Read more →
Apr 23, 2025 Codeforces

Key races

Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters

Read more →
Apr 22, 2025 HackerRank

Palindrome Index

Given a string of lowercase letters in the range ascii[a-z], determine the index of a character that can be removed to make the string a palindrome.

Read more →
Apr 22, 2025 Codechef

Chef and NextGen

Chef is currently working for a secret research group called NEXTGEN. While the rest of the world is still in search of a way to utilize Helium.

Read more →
Apr 21, 2025 Codechef

Sale Season

It's the sale season again and Chef bought items worth a total of X rupees. The sale season offer is as follows

Read more →
Apr 21, 2025 Leetcode

Add Strings

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

Read more →
Apr 19, 2025 HackerRank

Pangrams

A pangram is a string that contains every letter of the alphabet. Given a sentence determine whether it is a pangram in the English alphabet

Read more →
Apr 19, 2025 Codechef

CRED Coins

For each bill you pay using CRED, you earn X CRED coins. At CodeChef store, each bag is worth 100 CRED coins.

Read more →
Apr 18, 2025 Leetcode

Binary Watch

A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one.

Read more →
Apr 17, 2025 Codeforces

Game With Sticks

After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of n horizontal and m vertical.

Read more →
Apr 17, 2025 Leetcode

Longest Palindrome

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

Read more →
Apr 09, 2025 Leetcode

Reverse Integer

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range.

Read more →
Apr 09, 2025 Codechef

Best of Two

Chef took an examination two times. In the first attempt, he scored XX marks while in the second attempt he scored YY marks

Read more →
Apr 08, 2025 Leetcode

554 Brick Wall

There is a rectangular brick wall in front of you with n rows of bricks. The ith row has some number of bricks each of the same height (i.e., one unit)

Read more →
Apr 08, 2025 Codechef

Monopoly

There is said to be a monopoly in the market if the profit made by one company is strictly greater than the sum of profits made by all other companies

Read more →
Mar 30, 2025 Codeforces

427 Prison Transfer

The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison.

Read more →
Mar 17, 2025 Codeforces

Problem - 158B Taxi

After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists

Read more →
Mar 17, 2025 HackerRank Math

Find the Point

Consider two points,  and . We consider the inversion or point reflection, , of point  across point  to be a  rotation of point  around . Given  sets of points

Read more →
Mar 16, 2025 HackerRank

Staircase

Its base and height are both equal to . It is drawn using # symbols and spaces. The last line is not preceded by any spaces.

Read more →
Mar 16, 2025 Leetcode

Two Sum Problem

LeetCode Problem 1. Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

Read more →