-
Same Tree with Swift
Problem: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same value. Solution Using Breadth-First Search traverse trees and compare nodes…
-
Clone connected graph in Swift
Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Solution: Create a queue, process node and it’s neighbors, create copies of nodes processed and create a reference in a dictionary between original and new nodes.…
-
Count the number of ways to traverse a Matrix in Swift
Question: Count the number of ways to traverse a from the top left corner to the bottom, right corner. Limitation: we can only move down or right. Few solutions: first one brute force and second dynamic programming and measuring their time execution below. To compute…
-

CROSSFIT GAMES OPEN 20.1 STRATEGY AND ANALYSIS
20.1 CrossFit Open includes the following workout: 10 rounds for time of: 8 ground-to-overheads, 95 lb. 10 bar-facing burpees Time cap: 15 minutes
-
Minimum absolute difference in an array with Go
Problem url: https://www.hackerrank.com/challenges/minimum-absolute-difference-in-an-array/problem Solution: Results are generated in O(n)*log(n) since we are sorting the array first. We can transfer sorted array and compare each number with the next find to find the smallest difference. func minimumAbsoluteDifference(arr []int32) int32 { var f foo f = arr…
-
Migratory Birds problem from Hackerrank with Go
Problem url: https://www.hackerrank.com/challenges/migratory-birds/problem Solution: Results are generated in O(1) while traversing an array. We need to keep track of the largest value and keep a record of the smallest key. func migratoryBirds(arr []int32) int32 { //key value m := make(map[int32]int32) largest := int32(0) largestKey :=…
-

CROSSFIT GAMES OPEN 19.5 STRATEGY AND ANALYSIS
19.5 CrossFit Open includes the following workout: 33-27-21-15-9 reps for time of: 95-lb. thrusters Chest-to-bar pull-ups Time cap: 20 minutes
-

CROSSFIT GAMES OPEN 19.4 STRATEGY AND ANALYSIS
19.4 CrossFit Open includes the following workout: For total time: 3 rounds of: 10 Snatches, 95/65 lbs 12 Bar Facing Burpees Rest 3 mins 3 rounds of: 10 Bar Muscle-ups 12 Bar Facing Burpees Timecap is 12 mins.
-

CROSSFIT GAMES OPEN 19.3 STRATEGY AND ANALYSIS
19.3 CrossFit Open includes the following workout: For time: 200 ft Single Arm Dumbbell Overhead Walking Lunge 50/35 lbs 50 Single Dumbbell Box Step-ups 50/35 lbs, 24/20 in 50 Strict Handstand Push-ups 00 ft Handstand Walk Time cap: 10 mins
-

CROSSFIT GAMES OPEN 19.2 STRATEGY AND ANALYSIS
19.2 CrossFit Open includes the following workout: Beginning on an 8 min clock, complete as many reps as possible of: 25 Toes-to-bars 50 Double Unders 15 Squat Cleans, 135/85 lbs 25 Toes-to-bars 50 Double Unders 13 Squat Cleans, 185/115 lbs If completed before 8…