8 kyu
A Needle in the Haystack
77,069 of 184,026andrewMacmurray
Description:
Can you find the needle in the haystack?
Write a function findNeedle()
that takes an array
full of junk but containing one "needle"
After your function finds the needle it should return a message (as a string) that says:
"found the needle at position "
plus the index
it found the needle, so:
Example(Input --> Output)
["hay", "junk", "hay", "hay", "moreJunk", "needle", "randomJunk"] --> "found the needle at position 5"
Note: In COBOL, it should return "found the needle at position 6"
Arrays
Fundamentals
Similar Kata:
Stats:
Created | Dec 8, 2015 |
Published | Dec 9, 2015 |
Warriors Trained | 249625 |
Total Skips | 16796 |
Total Code Submissions | 395897 |
Total Times Completed | 184026 |
JavaScript Completions | 77069 |
C# Completions | 9028 |
Java Completions | 16909 |
CoffeeScript Completions | 79 |
Python Completions | 66682 |
Elixir Completions | 581 |
PHP Completions | 4590 |
Ruby Completions | 4068 |
C Completions | 2079 |
TypeScript Completions | 3210 |
Haskell Completions | 690 |
Racket Completions | 53 |
COBOL Completions | 13 |
Scala Completions | 141 |
C++ Completions | 2726 |
Total Stars | 1303 |
% of votes with a positive feedback rating | 91% of 12083 |
Total "Very Satisfied" Votes | 10036 |
Total "Somewhat Satisfied" Votes | 1812 |
Total "Not Satisfied" Votes | 235 |