Photo by Markus Winkler on Unsplash

Photo by Sarra Marzguioui on Unsplash


Input: Binary tree: [1,2,3,null,4]…

Photo by Benjamin Suter on Unsplash


Some Thoughts

  • The array is already sorted in ascending order. This means that we only need to iterate through the array once.
  • Initiate the result array with values as [-1…

Photo by Matt Lee on Unsplash

Photo by Aron Visuals on Unsplash

Photo by Shahadat Rahman on Unsplash

Photo by Niklas Veenhuis on Unsplash

My Linh Edition

One step at a time

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store