Tech > Coding Challenges > HackerRank > Prepare > Python > Basic Data Types > Find the Runner-Up Score!

Problem Link to the original HackerRank problem Given the participants’ score sheet for your University Sports Day, you are required to find the runner-up score. You are given n scores. Store them in a list and find the score of the runner-up. Input Format The first line contains n. The second line contains an array A[] of n integers each separated by a space. Constraints 2 <= n <= 10 -100 <= A[i] <= 100 Output Format ...

January 20, 2024 · 3 min · 497 words

Tech > Coding Challenges > HackerRank > Prepare > Python > Basic Data Types > List Comprehensions

Problem Link to the original HackerRank problem Let’s learn about list comprehensions! You are given three integers x, y and z representing the dimensions of a cuboid along with an integer n. Print a list of all possible coordinates given by (i, j, k) on a 3D grid where the sum of i + j + k is not equal to n. Here: 0 <= i <= x; 0 <= j <= y; 0 <= k <= z; Please use list comprehensions rather than multiple loops, as a learning exercise. ...

January 17, 2024 · 3 min · 438 words

Tech > Coding Challenges > HackerRank > Prepare > Python > Introduction > Print function

Problem Link to the original HackerRank problem The included code stub will read an integer, n, from STDIN. Without using any string methods, try to print the following: 123...n Note that “...” represents the consecuvitve values in between. Example n = 5 Print the string 12345 Input Format The first line contains an integer n. Constraints 1 <= n <= 150 Output Formats 1 <= n <= 150 Input Format ...

January 16, 2024 · 1 min · 207 words