about | help | code help+videos | done | prefs |
To reduce complexity, a company wants to generate the smallest number of least-significant digits from IDs (customer ID, order ID, staff ID, etc.). For example, if the original order IDs are {101, 128, 107, 105}, the shortened IDs are {1, 8, 7, 5}, and if the original order IDs are {10183, 27, 21183, 127}, the shortened IDs are {183, 27, 1183, 127}. Define a function that when passed a list containing n IDs (all different), returns a list containing the minimum number of least-significant digits to distinctively distinguish them. shortenedIDs([101, 128, 107, 105]) → [1, 8, 7, 5] shortenedIDs([25183, 10183]) → [5183, 183] shortenedIDs([10183, 27, 25183, 127]) → [183, 27, 5183, 127] shortened_IDs([101, 128, 107, 105]) → [1, 8, 7, 5] shortened_IDs([25183, 10183]) → [5183, 183] shortened_IDs([10183, 27, 25183, 127]) → [183, 27, 5183, 127] ...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: 5 Post-solution available
Copyright Nick Parlante 2017 - privacy