--- tags: AC LeetCode 刷題讀書會 - 2023 --- # 2023/07/16(日) 每週 LeetCode 刷題 ## 刷題題號 - [202. Happy Number]() ## 解題思路 Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: <pre style='background-color:#ggg'> - Starting with any positive integer, replace the number by the sum of the squares of its digits. - Repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. - Those numbers for which this process ends in 1 are happy. </pre> Return true if n is a happy number, and false if not. <pre style='background-color:#ggg'> 編寫一個算法來定義一個數字 n 是否是快樂數字。 - 從任何正整數開始,將數字特換成平方和。 - 重複這個過程直到數字等於 1(它將保持不變),或者它在不包括 1 的循環中無限循環。 - 這個過程以 1 結束的那些數字就是快樂數字。 如果 n 是一個快樂的數字,則回傳 true,否則回傳 false。 </pre> ## 回報格式 - 請 Fork 此 Replit 連結(https://replit.com/@AllenLi23/AC-LeetCode-Js-202-Happy-Number)後,進行程式碼解題,並於完成後更新到 Replit 中,再將連結貼至「解題分享區」來與大家交流做法。 解題分享區 --- 讀書會議流程: ex. 21:05開始 #簽到表: https://docs.google.com/spreadsheets/d/1gc16rrF-yZNs845z_nYrdgDIiSECOJok30dNLyQm69A/edit#gid=534323210 1. 題目說明。 2. 題目解析(BigO(n))。 4. 成員分享解題思路。 5. 問題與討論。 <!-- No.0 (請依序排序下去) name: name (回報範例) lighthouse: lighthouse Replit:https://replit.com/@AllenLi23/AC-LeetCode-Js-202-Happy-Number-Allen --> <!-- No.1 name: Jack Hung lighthouse: lhhungx@gmail.com Replit:https://replit.com/@LungHsuanHung/AC-LeetCode-Go-202-Happy-Number#main.go --> <!-- No.2 name: vanessa lighthouse: mali7591@hotmail.com Replit:https://replit.com/@vanessalin3/AC-LeetCode-Js-202-Happy-Number --> <!-- No.3 name: bun lighthouse: bun.coding@gmail.com Replit:https://replit.com/@Shu-YinChen/AC-LeetCode-Js-202-Happy-Number#index.js --> <!-- No.4 name: 小波 lighthouse: sean821125@gmail.com Replit:https://replit.com/@sean821125/AC-LeetCode-Js-202-Happy-Number#index.js --> <!-- No.5 name: Kai lighthouse: pythonforeye@gmail.com Replit:https://replit.com/@Beginneraboutli/AC-LeetCode-Js-202-Happy-Number#index.js --> <!-- No.6 name: Ben lighthouse: a84012807@gmail.com Replit:https://replit.com/@a84012807/AC-LeetCode-Js-202-Happy-Number#index.js --> <!-- No.7 name: Peggy lighthouse: peggy8865@gmail.com Replit:https://replit.com/@peggy8865/AC-LeetCode-Js-202-Happy-Number#index.js -->