Upcoming technologies, programming, problem solving, coding, technology, mobile phones
About us
Get link
Facebook
X
Pinterest
Email
Other Apps
In this blog you will be able to learn python-programming language and problem solving. You can also find solutions for hackerrank problems, google coding problems.
1. Cab and Walk Arun is working in an office which is N blocks away from his house. He wants to minimize the time it takes him to the from his house to the office. He can either take the office cab or he can walk to the office. While walking Arun's velocity is V1 m/s and V2 m/s is the velocity of cab. But when he calls the cab it always starts from the office, covers N blocks, collects Arun and goes back to the office. The cab crosses a total distance of N meters when going from office to Arun's house and vice versa , whereas Arun covers a distance of √2*N while walking. Help Arun to decide whether he has to walk or to take the cab to save the time. Input format : A single line containing three integers N, V1 and V2 separated by space. Output format : Print "Walk" or "Cab" accordingly. Sample input 1 : 5 10 15 Sample output 1 : Cab Sample input 2 : 2 10 14 Sample output 2 : Walk Code : Output : 2. End - Sort Given a list A of ...
Solution for hackerRank problems What's your name, Tuple in Python. 1. What's your name You are given the first name and lastname of a person on two different lines. Your task is to read them and print the following: "Hello firstname lastname! You just delved into python." Function Description Complete the print_full_name function in the editor below. print_full_name has the following parameters: string first: the first name string last: the last name Prints string: 'Hello firstname lastname! You just delved into python' where firstname and lastname are replaced with first and last. Input Format The first line contains the first name, and the second line contains the last name. Constraints The length of the first and last names are each ≤ . Sample Input 0 Ross Taylor Sample Output 0 Hello Ross Taylor! You just delved into python. Explanation 0 The input read by the program is stored as a string data type. A string is a collection of c...
Solution for hackerRank problem Sparse Arrays in C Problem : There is a collection of input strings and a collection of query strings. For each query string, determine how many times it occurs in the list of input strings. Return an array of the results. Example, stringList = [ 'ab', 'ab' , 'abc' ] queries = [ 'ab' , 'abc' , 'bc' ] There are 2 instances of 'ab', 1 of 'abc' and 0 of 'bc'. For each query, add an element to the return array, results = [2,1,0]. Function Description Complete the function matchingStrings in the editor below. The function must return an array of integers representing the frequency of occurrence of each query string in stringList. matchingStrings has the following parameters: string stringList[n] - an array of strings to search string queries[q] - an array of query strings Returns int[q]: an array of results for each query Input Format The first line contains and integer n, the ...
Comments
Post a Comment