8 kyu
A Needle in the Haystack
76,865 of 183,396andrewMacmurray
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 | 248731 |
Total Skips | 16746 |
Total Code Submissions | 394690 |
Total Times Completed | 183396 |
JavaScript Completions | 76865 |
C# Completions | 9001 |
Java Completions | 16859 |
CoffeeScript Completions | 79 |
Python Completions | 66402 |
Elixir Completions | 581 |
PHP Completions | 4578 |
Ruby Completions | 4064 |
C Completions | 2073 |
TypeScript Completions | 3189 |
Haskell Completions | 687 |
Racket Completions | 53 |
COBOL Completions | 13 |
Scala Completions | 140 |
C++ Completions | 2690 |
Total Stars | 1297 |
% of votes with a positive feedback rating | 91% of 12066 |
Total "Very Satisfied" Votes | 10020 |
Total "Somewhat Satisfied" Votes | 1811 |
Total "Not Satisfied" Votes | 235 |