7 kyu

Magic Index

1,733rickawd

Description:

A magic index in an array A[1...n-1] is defined to be an index such that A[i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A.

findMagic([-20,-10,2,10,20]); // Returns 2
Dynamic Programming
Recursion
Arrays
Algorithms

Stats:

CreatedSep 12, 2016
PublishedSep 12, 2016
Warriors Trained2225
Total Skips18
Total Code Submissions4021
Total Times Completed1733
JavaScript Completions1733
Total Stars14
% of votes with a positive feedback rating86% of 243
Total "Very Satisfied" Votes188
Total "Somewhat Satisfied" Votes42
Total "Not Satisfied" Votes13
Total Rank Assessments12
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • rickawd Avatar
  • jhoffner Avatar
Ad