Saloni6111 / DSA_Problems-Hacktoberfest-2024

Solve given DSA problems here for hactoberfest.
13 stars 35 forks source link

K-th Smallest in Lexicographical Order #93

Closed Ash914027 closed 4 minutes ago

Ash914027 commented 4 hours ago

K-th Smallest in Lexicographical Order

Difficulty: Hard

Given two integers n and k, return the kth lexicographically smallest integer in the range [1, n].

 

Example 1:

Input: n = 13, k = 2
Output: 10
Explanation: The lexicographical order is [1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9], so the second smallest number is 10.

Example 2:

Input: n = 1, k = 1
Output: 1

 

Constraints:

Ash914027 commented 4 hours ago

PLEASE ASSIGN THIS ISSUE UNDER HACKTOBERFEST 2024

Saloni6111 commented 2 hours ago

PLEASE ASSIGN THIS ISSUE UNDER HACKTOBERFEST 2024

@Ash914027 Done!