Skip to main content

Posts

Showing posts from November, 2021

Successfully installing CocoaPods in M1 Macs

Installation steps of cocoapods in the new Macs with M1 chipset is little different than Intel based Macs. If we casually run `pod install`, we are likely to encounter error related to the ffi gem 🤨. Open the terminal and follow below steps to solve the error and install pod dependencies successfully. Step1 : At first, install ffi gem intel version > sudo arch -x86_64 gem install ffi Steps 2: Install cocoapod  > sudo gem install cocoapods Steps 3 (optional) : Go to project root folder and initialise pod file if not created already. > arch -x86_64 pod init Steps 4: Now Install pod dependencies. > arch -x86_64 pod install

HackerRank Exercise : Kangaroo Number Line Jumps Solved in Swift 5.0

Given two kangaroos on a number line ready to jump in the positive direction, we have to figure out a way to get both kangaroos at the same location at the same time as part of the show. If it is possible, return YES , otherwise return NO . Read full problem statement from here Working solution in Swift           func kangaroo ( x1 : Int , v1 : Int , x2 : Int , v2 : Int ) -> String {         var multiplier = 1         // 1.         while (multiplier < 10000 ) {             // 2.             if (x1+(v1*multiplier) == x2+(v2*multiplier)) {                 return "YES"             }                          multiplier += 1         }            ...