8 kyu
A Needle in the Haystack
16,879 of 183,673andrewMacmurray
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 | 249171 |
Total Skips | 16767 |
Total Code Submissions | 395240 |
Total Times Completed | 183673 |
JavaScript Completions | 76953 |
C# Completions | 9015 |
Java Completions | 16879 |
CoffeeScript Completions | 79 |
Python Completions | 66530 |
Elixir Completions | 581 |
PHP Completions | 4584 |
Ruby Completions | 4067 |
C Completions | 2075 |
TypeScript Completions | 3193 |
Haskell Completions | 688 |
Racket Completions | 53 |
COBOL Completions | 13 |
Scala Completions | 140 |
C++ Completions | 2708 |
Total Stars | 1299 |
% of votes with a positive feedback rating | 91% of 12075 |
Total "Very Satisfied" Votes | 10028 |
Total "Somewhat Satisfied" Votes | 1812 |
Total "Not Satisfied" Votes | 235 |