Interview Questions, Answers and Tutorials

Category: HackerRank

Popular online resource HackerRank provides programmers, developers, and data scientists with a variety of coding challenges, competitions, and technical evaluations. It’s a great tool for improving coding abilities, getting ready for technical interviews, and testing one’s knowledge of different programming languages and fields.

Alphabet Rangoli

Task You are given an integer, N. Your task is to print an alphabet rangoli of size N. (Rangoli is a form of Indian folk art based on creation of patterns.) Different sizes of alphabet rangoli are shown below: The center of the rangoli has the first alphabet letter a, and the boundary has the Nth alphabet letter (in alphabetical order). Function Description Complete the rangoli function in the editor below. Rangoli has the following parameters: Returns Input Format Only one line of input containing N, the size of the rangoli. Constraints 0 < N < 27 Sample Input Sample…

String Formatting

Task Given an integer, n, print the following values for each integer i from 1 to n: Function Description Complete the print_formatted function in the editor below. print_formatted has the following parameters: int number: the maximum value to print Prints The four values must be printed on a single line in the order specified above for each i from 1 to the number. Each value should be space-padded to match the width of the binary value of the number, and the values should be separated by a single space. Input Format A single integer denoting n. Constraints Sample Input Sample…

Text Wrap

Task You are given a string S and a width w. Your task is to wrap the string into a paragraph of width w. Function Description Complete the wrap function in the editor below. Wrap has the following parameters: Returns Input Format The first line contains a string, String.The second line contains the width, Max_Width. Constraints Sample Input 0 Sample Output 0 Solution: What Is Textwrap? Text wrap is a Python module used to wrap and format plain text.

Persistent Systems’ Sr Python Developer Hiring Challenge (2025)

Fitness Challenge (100 Marks) Samantha and Jessica are two sisters who are preparing for their annual fitness challenge. They both have been assigned a personal trainer who has given them a workout plan for the next few weeks. The plan includes a set of N exercises, and for each exercise, there is a recommended number of sets and repetitions. Samantha and Jessica have been keeping track of the number of sets and repetitions they have completed for each exercise. At the end of each day, they compare their progress by calculating the sum of squared differences in the number of…