---
title: "Discussion on \"LeetCode 202 - Happy Number(cycle detection)\" | Hashnode"
description: "Discussion on \"LeetCode 202 - Happy Number(cycle detection)\". Read question here: https://leetcode.com/problems/happy-number/\nSolution:\nclass Solution {\n  public boolean isHappy(int n) {\n    int slow = squaredSum(n);\n    int fast = squaredSum(squaredSum(n));\n\n    while (slow != fast) {\n      slow = squaredSum(s..."
url: "https://hashnode.com/posts/leetcode-202-happy-numbercycle-detection/640186f544c3e8b06cd1c9d5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [LeetCode 202 - Happy Number(cycle detection)](https://imkraman.hashnode.dev/leetcode-202-happy-numbercycle-detection?utm_source=hashnode&utm_medium=feed)

Read question here: https://leetcode.com/problems/happy-number/ Solution: class Solution { public boolean isHappy(int n) { int slow = squaredSum(n); int fast = squaredSum(squaredSum(n)); while (slow != fast) { slow = squaredSum(s...

Mar 3, 2023 · 5 min read · imkraman.hashnode.dev  
Read the article

-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#leetcode](https://hashnode.com/tag/leetcode)
-   [#algorithms](https://hashnode.com/tag/algorithms)
-   [#coding](https://hashnode.com/tag/coding)
-   [#cycle-detection](https://hashnode.com/tag/cycle-detection)

## Written by

[Aman](https://hashnode.com/@imkraman)

@imkraman

  
[View profile](https://hashnode.com/@imkraman)

not just boring code!!

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
