![]() |
Given a positive number ‘N’, the task is to find whether ‘N’ is balanced or not. Output ‘YES’ if ‘N’ is a balanced number else ‘NO’. A number is balanced if the frequency of all the digits in it is same i.e. all the digits appear the same number of times. Examples: Input: N = 1234567890 Output: YES The frequencies of all the digits are same. i.e. every digit appears same number of times. Input: N = 1337 Output: NO Approach:
Below is the implementation of the above approach: C++
Javascript
Output
NO Complexity Analysis:
|
Reffered: https://www.geeksforgeeks.org
Mathematical |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 9 |