↳
reverse the linked list, iterate through it and print, reverse it back.
↳
traverse through it using a recursive function with a printing statement after the traversal statement so when it gets to the end of the function and its returning, it will print along the way. Less
↳
def reverse[T](seq: Seq[T]): Seq[T] = { seq match { case Nil => Seq() case head :: tail => reverse(tail) :+ head } } println(reverse(List('A', 'B', 'C', 'D', 'E'))) Less
↳
Convert the strings to objects with each word being added as a property to speed up the lookup. I had heard of this technique but never done it myself. Less
↳
sort the words will be done in n Log n . for each word in 1st string do binary search on other string which will run in n log n so overall complexity will be n log n. Less
↳
My answer started out a simple string comparison, but then realized the algorithm needs to be a little more complex to satisfy the requirement. I turned the strings into arrays, then created a function that used a nested for loop to compare the arrays. similar to the native String.indexOf() method, only customized for the requirement. Less
↳
You can use a hash map to count the words in the two arrays. Words with count==1 are the answer Less
↳
with the help of addClass and removeClass function using (this)
↳
Because i'm more qualified for the job than most candidates waiting outside