It’s been a while since I found myself without a job and feeling lost in life.
I’ve been working as an iOS Engineer professionally since 2016, although I’ve been doing it alone, remotely and at a startup, which made it really difficult to bounce ideas, learn from other people and solve problems quicker.


I’m very aware of the luck and privilege to have had that job and the opportunity to get better on my own and do what I love, but my god sometimes it was really difficult. It was just me, my window and the occasional pigeon passing by, and yeah of course a lot of Google, Stack Overflow and maybe asking on other places like IRC, forums, etc.

But now there is no job, there are changes in the world, in the country where the startup was based (and in my own), inflation is like taking steroids or something, and now I find myself thinking about what is going to happen - and all of this within the span of a month.

So for now I’m going into the Void of constant interviews and see what happens. Wish me luck.




Again, this is a regular share from study I do from time to time to remind myself of stuff. Currently re-reading Swift Algorithms & Data Structures by Wayne Bishop.



import Foundation

let numberList : Array<Int> = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

/// Looks for a number using a binary search technique, which gives us
/// a O(log n) performance.
/// - Parameter numberToLookFor: The number (`Int`) to look for in the array
/// - Parameter indexMin: Index bound of the array of the left side (minimum) to look inside the array
/// - Parameter indexMax: Index bound of the array of the righ side (maximum) to look inside the array
func searchForNumber(numberToLookFor:Int, indexMin:Int, indexMax:Int) {

  /// First we get the middle of the bounds, we use round to reach ceiling
  /// Meaning if is 3.5 and up we reach 4 as an example
  let midIndex:Double = round(Double(indexMin+indexMax) / 2)

  /// Lets get the value from that index
  let valueForTheMidIndex = numberList[Int(midIndex)]

  /// Log to understand the recursivness
  print("Running searchForNumber with numberToLookFor: \(numberToLookFor), indexMin:\(indexMin), indexMax: \(indexMax), meaning we have a midIndex: \(midIndex) and a valueForTheMidIndex: \(valueForTheMidIndex) \n")

  /// Check if the we are looking for is on the left side (less than our valueForTheMidIndex)
  if numberToLookFor < valueForTheMidIndex {
    print("Key(\(numberToLookFor)) is less than \(valueForTheMidIndex )\n")
    searchForNumber(numberToLookFor: numberToLookFor, indexMin: indexMin, indexMax: Int(midIndex) - 1)
  } else if numberToLookFor > valueForTheMidIndex {
        print("Key(\(numberToLookFor)) is major than \(valueForTheMidIndex )\n")
    searchForNumber(numberToLookFor: numberToLookFor, indexMin: Int(midIndex) + 1, indexMax: indexMax)
  } else {
    print("found number at index \(midIndex)")
  }

}

searchForNumber(numberToLookFor: 8, indexMin: 0, indexMax: numberList.count-1)