Skip to main content

Posts

Showing posts from January 1, 2021
  Easy Count Length of Cycle Election Longest Uniform String Run Length Encoding Search Tree Second Smallest Walking Robot Moderate Best Average Grade Longest Word Median Two Sorted Arrays Snowpack Stair Case Hard HashMap Lowest Price Prefix Search Easy Count Length of Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 /** * Instructions to candidate. * 1) Run this code in the REPL to observe its behaviour. The * execution entry point is main(). * 2) Consider adding some additional tests in doTestsPass(). * 3) Implement countLengthOfCycle() correctly. * 4) If time permits, try to improve your implementation. */ var _ = require('lodash'); /** * countLengthOfCycle(arr, startIndex) * * You are given an integer array of size N. * Every element of the array is greater than or equal to 0. * Starting from arr[startIndex], follow each elem...