about | help | code help+videos | done | prefs |
sliceDigitDifference
Write a method that accepts two integers as input parameters. The first integer, num, will be positive and have at least three digits. The second integer, splitAt, will be a single, positive digit. That digit will appear exactly once in the first number. The digit represented by splitAt will cut the num into two different parts. For example, 483251 with a splitAt of 2 will split the number into 483 and 51, the numbers that comes before and after splitAt. Return the positive difference between these two numbers. So in the example above, you would return 432 because 483-51=432. Remember that the digit splitAt will only occur once in num. sliceDigitDifference(9857323, 8) → 57314 sliceDigitDifference(41287833, 2) → 87792 sliceDigitDifference(872, 7) → 6 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 280
Copyright Nick Parlante 2017 - privacy