Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Sunday, April 5, 2020

Structuring the Document - Hacker Rank Solution

Structuring 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.

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.
Powered by Blogger.