File tree 4 files changed +49
-8
lines changed
4 files changed +49
-8
lines changed Original file line number Diff line number Diff line change 1
- # ACM
2
- ACM type problems solved by me.
3
-
4
- <br ><br >
5
-
6
1
** Arafat Hasan Jenin** * <opendoor.arafat[ at] gmail[ dot] com>*
7
- Mawlana Bhashani Science and Technology University
8
- Santosh, Tangail
9
2
* From Rangpur, Bangladesh*
10
3
11
4
12
5
<br ><br >
13
6
14
- #### My IDs in commpetitive programming platforms
7
+ #### My IDs in various problem solving platforms
15
8
Codeforce: [ arafat_hasan] ( http://codeforces.com/profile/arafat_hasan/ )
16
9
Uva: [ arafat_hasan] ( http://uhunt.onlinejudge.org/id/859424/ )
17
10
HackerRank: [ arafat_hasan] ( https://www.hackerrank.com/arafat_hasan/ )
Original file line number Diff line number Diff line change
1
+ /*
2
+ * FILE: 1207.unique_number_of_occurrences.cpp
3
+ * @author: Arafat Hasan Jenin <opendoor.arafat[at]gmail[dot]com>
4
+ * LINK: https://leetcode.com/problems/unique-number-of-occurrences
5
+ * DATE CREATED: 30-11-22 11:49:33 (+06)
6
+ * LAST MODIFIED:
7
+ * VERDICT: Accepetd
8
+ */
9
+
10
+ class Solution {
11
+ public:
12
+ bool uniqueOccurrences (vector<int >& arr) {
13
+ unordered_map<int , int > freq;
14
+ unordered_set<int > st;
15
+ for (auto i : arr) freq[i]++;
16
+ for (auto i : freq) st.insert (i.second );
17
+ return st.size () == freq.size ();
18
+ }
19
+ };
Original file line number Diff line number Diff line change
1
+ // class Solution {
2
+ // public:
3
+ // int maximum69Number(int num) {
4
+ // string str = to_string(num);
5
+ // for (auto &c : str) {
6
+ // if (c == '6') {
7
+ // c = '9';
8
+ // break;
9
+ // }
10
+ // }
11
+
12
+ // return stoi(str);
13
+ // }
14
+ // };
15
+
16
+ class Solution {
17
+ public:
18
+ int maximum69Number (int num) {
19
+ int p = 1 ;
20
+ int n = num, maxp = 0 ;
21
+ while (n > 0 ) {
22
+ int digit = n % 10 ;
23
+ if (digit == 6 ) maxp = p;
24
+ p *= 10 ;
25
+ n /= 10 ;
26
+ }
27
+ return num + (maxp * 3 );
28
+ }
29
+ };
File renamed without changes.
You can’t perform that action at this time.
0 commit comments