- Get link
- X
- Other Apps
function solve1 ( input ) { let obj = {}; input . split ( ' \n ' ). forEach ( el => { obj [ el . split ( ': ' )[ 0 ]] = el . split ( ': ' )[ 1 ] }); console . log ( obj ) let t = obj [ 'root' ]. split ( ' ' ); let first = t [ 0 ]; let second = t [ 2 ]; console . log ( find_humn ( first , obj , false )) console . log ( find_humn ( second , obj , false )) let solved_one_half = find_humn ( first , obj , false ) == true ? solve ( second , obj ) : solve ( first , obj ); console . log ( solved_one_half ) console . log ( solve ( first , obj )*- 1 ) let result = find_humn_value ( obj , solved_one_half *- 1 , find_humn ( first , obj , false ) == true ? first : second ) return result ; } function find_humn ( node , obj , value ) { if ( value ) return value ; if ( isNaN ( obj [ node ]. trim ())) // not a number,,solve again { let