Sunday, April 5, 2020

Post Transition - Hacker Rank Solution

Post Transition - Hacker Rank Solution
For print_all_packages you should simply traverse every town, office and package in the correct order.
For send_all_acceptable_packages first you should determine the number of packages in two offices after transaction.

Small Triangles, Large Triangles - Hacker Rank Solution

Small Triangles, Large Triangles - Hacker Rank Solution

Boxes through a Tunnel - Hacker Rank Solution

Boxes through a Tunnel - Hacker Rank Solution

Querying the Document - Hacker Rank Solution

Querying the Document - Hacker Rank Solution

The true problem here is to write function  from string. Let's write some assisting functions ,  and . They all will take some substring of the original string as a parameter. You can pass the substring itself, however, in order to save time and memory, two indices are recommended instead: the index of the original string where the substring begins and the index of the original string where the substring ends.

Sunday, January 19, 2020

Variadic functions in C - Hacker Rank Solution

Variadic functions in C - Hacker Rank Solution

There is no built in way for a variadic function to know how many parameters have been passed. You don't have to use them all, but if you request too many, you will get garbage.

Saturday, January 18, 2020

Permutations of Strings - Hacker Rank Solution

Strings are usually ordered in lexicographical order. That means they are ordered by comparing their leftmost different characters.

Friday, January 17, 2020

Sorting Array of Strings - Hacker Rank Solution

Sorting Array of Strings - Hacker Rank Solution

You can use any sorting algorithm to sort strings in . Bubble sort is fast enough for the constraints in this problem. Let's look how should the bodies of the comparing functions look like.

Thursday, January 16, 2020

Students Marks Sum - Hacker Rank Solution

You are given an array of integers, , denoting the marks scored by students in a class.
  • The alternating elements , ,  and so on denote the marks of boys.
  • Similarly, , ,  and so on denote the marks of girls.

Wednesday, January 15, 2020

Calculate the Nth term - Hacker Rank Solution

Objective
This challenge will help you learn the concept of recursion.
A function that calls itself is known as a recursive function. The C programming language supports recursion. But while using recursion, one needs to be careful to define an exit condition from the function, otherwise it will go into an infinite loop.

Tuesday, January 14, 2020

Dynamic Array in C - Hacker Rank Solution

Snow Howler is the librarian at the central library of the city of HuskyLand. He must handle requests which come in the following forms:

Monday, January 13, 2020

Digit Frequency - Hacker Rank Solution

Digit Frequency - Hacker Rank Solution

Printing Tokens - Hacker Rank Solution

Given a sentence, , print each word of the sentence in a new line.
Powered by Blogger.