adding happy number problem

This commit is contained in:
Jidong Xiao
2023-11-06 23:08:05 -05:00
parent 413aa72495
commit 73e1092f5c

View File

@@ -1,5 +1,4 @@
#include <iostream> #include <iostream>
#include <unordered_map>
bool isHappy(int n) { bool isHappy(int n) {
} }
@@ -9,7 +8,7 @@ int main() {
// 2, 4, 5, 6, 17, 18, 20 are not happy numbers. // 2, 4, 5, 6, 17, 18, 20 are not happy numbers.
// 1, 7, 10, 13, 19, 23, 28, 68 are not happy numbers. // 1, 7, 10, 13, 19, 23, 28, 68 are not happy numbers.
int testCases[] = {2,4,5,6,17,18,20,68,1,7,10,13,19,23,28}; int testCases[] = {2,4,5,6,17,18,20,1,7,10,13,19,23,28,68};
for (int n : testCases) { for (int n : testCases) {
if (isHappy(n)) { if (isHappy(n)) {