Posts

Showing posts with the label computing paradox

Python3 hackerRank exercise with solutions (Set 3)

Image
  1.  Computing paradox  : You are provided with a playlist of N songs, each has a unique positive integer length. Assume that you like all songs in the playlist, but there would be a song that you like more than other songs. It is named as computing paradox. You decided to sort the songs in increasing order of song length. For example , if the length of the songs in a list are {1,3,5,2,4} after sorting it becomes {1,2,3,4,5}. Before sorting , "Computing paradox" was on  k_ th  position in the playlist. Your task is to find the position of "Computing paradox" in the sorted playlist. Input format The first line contains the number N denoting the number of songs in the playlist. The second line contains N space separated integers A1,A2,....An denoting the length of each song. The third line contains an integer k , denoting the position of the Computing paradox in the initial playlist. Output format A single line containing the position of Computing paradox in the sort