We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
List[Int] is accumulator, () near List[Int] means that it's an empty List at the beginning; (acc, v) => v:acc is a function that receives accumulator and value from left and than adds this into List - :: operation.
try in console: 5::4::3::2::1::Nil
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a List
You are viewing a single comment's thread. Return to all comments →
List[Int] is accumulator, () near List[Int] means that it's an empty List at the beginning; (acc, v) => v:acc is a function that receives accumulator and value from left and than adds this into List - :: operation. try in console: 5::4::3::2::1::Nil