8 kyu
A Needle in the Haystack
4,088 of 187,200andrewMacmurray
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 | 253919 |
Total Skips | 17091 |
Total Code Submissions | 401938 |
Total Times Completed | 187200 |
JavaScript Completions | 78008 |
C# Completions | 9170 |
Java Completions | 17164 |
CoffeeScript Completions | 79 |
Python Completions | 68234 |
Elixir Completions | 583 |
PHP Completions | 4638 |
Ruby Completions | 4088 |
C Completions | 2123 |
TypeScript Completions | 3303 |
Haskell Completions | 697 |
Racket Completions | 55 |
COBOL Completions | 13 |
Scala Completions | 144 |
C++ Completions | 2885 |
Total Stars | 1324 |
% of votes with a positive feedback rating | 91% of 12170 |
Total "Very Satisfied" Votes | 10107 |
Total "Somewhat Satisfied" Votes | 1828 |
Total "Not Satisfied" Votes | 235 |