Skip to content

Commit 278de83

Browse files
Update Uniquedigits.cpp
1 parent bcce4df commit 278de83

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Math/Uniquedigits.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ Next, we enter a loop that runs n-1 times (since we have already considered the
1313
1414
Finally, we return the value of ans.
1515
16-
*/
16+
The time complexity of this algorithm is O(n), where n is the input parameter representing the number of digits.
17+
18+
The space complexity of this algorithm is O(1), as we are only using a constant amount of extra memory to store the variables ans, unique_digits, and available_digits, regardless of the input size.
1719
20+
*/
1821
-------------------------------------------------------------------------//C++ code begins here----------------------------------------------------------------------------
1922

2023
class Solution {

0 commit comments

Comments
 (0)