You are viewing a single comment's thread. Return to all comments →
Mega easy Perl solution:
sub icecreamParlor { my $m = shift; my $arr = shift; my @res_arr; for (my $i = 0; $i < scalar(@$arr); $i++){ for (my $j = $i + 1; $j < scalar(@$arr); $j++) { if ($m == ($arr->[$i] + $arr->[$j])) { push(@res_arr, $i+1, $j+1); return sort {$a <=> $b} @res_arr; } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Mega easy Perl solution: