EyeNewz Tech Get the app

Geeksforgeeks · Technology

Smallest number with given digit count and sum

Given two integers s and d, find the smallest possible number that has exactly d digits and a sum of digits equal to s.Return the number as a string. If no such number exists, return "-1".Examples :Input: s = 9, d = 2Output: 18 Explanation: 18 is the smallest number

Read original Open in app

Licensed summary · LicensedSummary