7 kyu
Find the nth Digit of a Number
4,491 of 12,616Goncalerta
Description:
Complete the function that takes two numbers as input, num
and nth
and return the nth
digit of num
(counting from right to left).
Note
- If
num
is negative, ignore its sign and treat it as a positive value - If
nth
is not positive, return-1
- Keep in mind that
42 = 00042
. This means thatfindDigit(42, 5)
would return0
Examples(num
, nth
--> output)
5673, 4 --> 5
129, 2 --> 2
-2825, 3 --> 8
-456, 4 --> 0
0, 20 --> 0
65, 0 --> -1
24, -8 --> -1
Fundamentals
Similar Kata:
Stats:
Created | Jul 5, 2016 |
Published | Jul 6, 2016 |
Warriors Trained | 22308 |
Total Skips | 2981 |
Total Code Submissions | 57902 |
Total Times Completed | 12616 |
JavaScript Completions | 4491 |
C++ Completions | 1863 |
Ruby Completions | 574 |
Python Completions | 3625 |
CoffeeScript Completions | 14 |
Swift Completions | 1145 |
C# Completions | 491 |
Rust Completions | 639 |
C Completions | 139 |
Total Stars | 211 |
% of votes with a positive feedback rating | 90% of 1790 |
Total "Very Satisfied" Votes | 1461 |
Total "Somewhat Satisfied" Votes | 286 |
Total "Not Satisfied" Votes | 43 |