8 kyu
A Needle in the Haystack
75,729 of 179,741andrewMacmurray
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 | 243821 |
Total Skips | 16432 |
Total Code Submissions | 387499 |
Total Times Completed | 179741 |
JavaScript Completions | 75729 |
C# Completions | 8847 |
Java Completions | 16559 |
CoffeeScript Completions | 78 |
Python Completions | 64722 |
Elixir Completions | 578 |
PHP Completions | 4498 |
Ruby Completions | 4040 |
C Completions | 2031 |
TypeScript Completions | 3090 |
Haskell Completions | 665 |
Racket Completions | 52 |
COBOL Completions | 13 |
Scala Completions | 138 |
C++ Completions | 2470 |
Total Stars | 1275 |
% of votes with a positive feedback rating | 91% of 11946 |
Total "Very Satisfied" Votes | 9914 |
Total "Somewhat Satisfied" Votes | 1798 |
Total "Not Satisfied" Votes | 234 |