about | help | code help+videos | done | prefs |
Write a method that compares the first few digits of 'original' to the entire 'target'. If the first few digits of 'original' exactly match all of the 'target' digits, in the same order, return the total number of digits in 'target'. Otherwise return -1 as a special value to indicate failure to find the 'target' digits at the start of 'original'. Both 'original' and 'target' will be positive integers. If 'target' has more digits than 'original' return -1 since 'target' cannot fit in 'original'. You may NOT use ANY strings or string methods. Look at the test data for examples. may25_2018_APSL_FirstFind(12425, 1242) → 4 may25_2018_APSL_FirstFind(82471, 82) → 2 may25_2018_APSL_FirstFind(1924, 42) → -1 ...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: 290
Copyright Nick Parlante 2017 - privacy