dark_knight
BAN USER- 1of 1 vote
AnswersGiven an array of "array range", return an optimized array by deleting subarrays.
- dark_knight in United States
NOTE: Array range (2,6) represents (2,3,4,5,6)
INPUT: [(2,6),(3,5),(7,21),(20,21)]
OUTPUT: [(2,6),(7,21)]
Reason: (3,5) is a subarray of (2,6) and (20,21) is a subarray of (7,21)| Report Duplicate | Flag | PURGE
Google Software Engineer Intern Algorithm - 1of 1 vote
AnswersGiven a sentence in a form of a string, reverse the words in the string and return a string. Handle a case where there might be period at the end of the sentence. If there is a period, the period has to come to the end of the reversed sentence. Discuss the time complexity of your algorithm.
- dark_knight in United States
INPUT: "This is a sentence"
OUTPUT: "sentence a is This"
INPUT2: "This one has period."
OUTPUT2: "period has one This."| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Intern Algorithm
Nice job! This is the cleanest algorithm I have seen so far. JS can be handy sometimes.
- dark_knight October 19, 2015
No. You are removing an array range that is a subset of another.
- dark_knight October 20, 2015