This repository contains programs(programmed in python) for programming challenges listed for 10daysofcodevvce in HackerRank.
All the problem statements are listed in hackerrank website.
A left rotation operation on an array of size n shifts each of the array's elements 1 unit to the left. For example, if 2 left rotations are performed on array [1,2,3,4,5], then the array would become [3,4,5,1,2]. Given an array of n integers and a number, d, perform d left rotations on the array. Then print the updated array as a single line of space-separated integers.
A linked list is said to contain a cycle if any node is visited more than once while traversing the list. Complete the function provided for you in your editor. It has one parameter: a pointer to a Node object named "head" that points to the head of a linked list. Your function must return a boolean denoting whether or not there is a cycle in the list. If there is a cycle, return true; otherwise, return false.
You have three stacks of cylinders where each cylinder has the same diameter, but they may vary in height. You can change the height of a stack by removing and discarding its topmost cylinder any number of times. Find the maximum possible height of the stacks such that all of the stacks are exactly the same height. This means you must remove zero or more cylinders from the top of zero or more of the three stacks until they're all the same height, then print the height. The removals must be performed in such a way as to maximize the height.
A queue is an abstract data type that maintains the order in which elements were added to it, allowing the oldest elements to be removed from the front and new elements to be added to the rear. This is called a First-In-First-Out (FIFO) data structure because the first element added to the queue (i.e., the one that has been waiting the longest) is always the first one to be removed.
A basic queue has the following operations:
Enqueue: add a new element to the end of the queue. Dequeue: remove the element from the front of the queue and return it. In this challenge, you must first implement a queue using two stacks. Then process q queries, where each query is one of the following 3 types:
1: Enqueue element x into the end of the queue. 2: Dequeue the element at the front of the queue. 3: Print the element at the front of the queue.
Comparators are used to compare two objects. In this challenge, you'll create a comparator and use it to sort an array. The Player class is provided in the editor below. It has two fields:
Name : a string. Score : an integer. Given an array of n Player objects, write a comparator that sorts them in order of decreasing score. If 2 or more players have the same score, sort those players alphabetically ascending by name. To do this, you must create a Checker class that implements the Comparator interface, then write an int compare(Player a, Player b) method implementing the Comparator.compare(T o1, T o2) method.
Refer the link below for the problem statement. https://www.hackerrank.com/challenges/knightl-on-chessboard/problem
Refer the link below for the problem statement. https://www.hackerrank.com/challenges/countingsort4/problem
Refer the link below for the problem statement. https://www.hackerrank.com/challenges/alice-and-bobs-silly-game/problem
Refer the link below for the problem statement. https://www.hackerrank.com/challenges/the-best-aptitude-test/problem
Refer the link below for the problem statement. https://www.hackerrank.com/challenges/littlepandapower/problem