id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com > otherChildHeap
prev  |  next  |  chance

Return the value of the other child of the given index's parent. Return -1 if there is no other child for the given index.


otherChildHeap([0, 2, 4, 5, 6, 7, 10, 20, 8, 11, 9], 3) → 4
otherChildHeap([0, 2, 4, 5, 6, 7, 10, 20, 8, 11, 9], 2) → 5
otherChildHeap([0, 2, 4, 5, 6, 7, 10, 20, 8, 11, 9], 4) → 7

...Save, Compile, Run (ctrl-enter)

public int otherChildHeap(int[] heap, int index) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy