# HackerRank C

## Dynamic Array in C – Hacker Rank Solution

Problem Snow Howler is the librarian at the central library of the city of HuskyLand. He must handle requests which come in the following forms: 1 x y : Insert a book with y pages at the end of the xth shelf.2 x y : Print the number of pages in the yth book on the xth shelf.3 x : Print the number …

## Digit Frequency in C – Hacker Rank Solution

Problem  Given a string, S, consisting of alphabets and digits, find the frequency of each digit in the given string. Input Format : The first line contains a string, num which is the given number. Constraints : 1<=len(num)<=1000All the elements of num are made of english alphabets and digits. Output Format : Print ten space-separated integers in a …

## Printing Tokens in C – Hacker Rank Solution

Problem Given a sentence, S, print each word of the sentence in a new line. Input Format The first and only line contains a sentence, S. Constraints 1<=len(s)<=1000 Output Format Print each word of the sentence in a new line. Sample Input 0 This is C Sample Output 0 This is C Explanation 0 In the given …

## Printing Pattern Using Loops – Hacker Rank Solution

Objective In this problem, you need to print the pattern of the following form containing the numbers from 1 to n. 4 4 4 4 4 4 4 4 3 3 3 3 3 4 4 3 2 2 2 3 4 4 3 2 1 2 3 4 4 3 2 2 2 3 4 4 3 …

## Array Reversal in C – Hacker Rank Solution

Problem Given an array, of size n, reverse it.Example: If array, arr = [1,2,3,4,5], after reversing it, the array should be, arr[5,4,3,2,1]. Task Input Format : The first line contains an integer, n, denoting the size of the array. The next line contains n space-separated integers denoting the elements of the array. Constraints : 1<=n<=1000 1<=arri<=1000, where arri is the ith element of …

## 1D Arrays in C – Hacker Rank Solution

Objective An array is a container object that holds a fixed number of values of a single type. To create an array in C, we can do int arr[n];. Here, arr, is a variable array which holds up to 10 integers. The above array is a static array that has memory allocated at compile time. A dynamic array …