Link
Problem
https://leetcode.com/problems/happy-number/
Initial Solution (Recursion)
First I tried using recursion, it worked for the test case provided but when I executed it against some custom test cases with Input: n=11, 12, 13 etc.
To detect that the loop will run endlessly we need to check if the value generated has appeared earlier. We can use a HashSet for the same as it can search its element in O(1) and we don’t need to store duplicate values.
the execution was either getting into StackOverflow exception or was very slow. So it was unable to return any result due to the timeout or exceeding the stack size.
Recommended Solution (Optimal — Non Recursion)
Then I decided to implement it using iterative / non recursive approach.
Below is my solution which has passed many test cases and is accepted by LeetCode as correct solution.
0 notes
Photo

challenge 1: Draw and color using any medium, 10 different types of flowers #21daysdrawingchallenge (at Hyderabad High-tech City) https://www.instagram.com/p/CHzMS5hhmm2/?igshid=1xd9z2jusyyl3
0 notes
Photo

#Throwbacks.. . turned 6 today!
0 notes
Video
CIMG6743 by Chip Rodgers
0 notes
Video
DSC_0618 by Chip Rodgers
0 notes
Video
DSC_0611 by Chip Rodgers
0 notes
Video
DSC_0602 by Chip Rodgers
0 notes
Video
DSC_2433 by Chip Rodgers
0 notes
Video
DSC_2432 by Chip Rodgers
0 notes
Video
DSC_2403 by Chip Rodgers
0 notes
Video
DSC_2402 by Chip Rodgers
0 notes
Video
TechEd Bangalore Day 1 and 2 020 by Marilyn Pratt
0 notes
Video
TechEd Bangalore Day 1 and 2 021 by Marilyn Pratt
0 notes
Video
youtube
“The Chennakesava temple of Somnathpura” is also shown in this song
"Raagam Taanam Pallavi" of movie "Sankarabharanam".
0 notes
Photo

Wearing Glass (not Project Glass from Google ) on Flickr.
"The Chennakesava temple of Somnathpura" The photo was taken at Chennakeshava temple at Belur, Hassan district in Karnataka around 225 kms from Bangalore. This temple was built in the year 1117 AD commissioned by Hoysala King Vishnuvardhana. Keshava (Sanskrit: keśava केशव) is a name of Lord Krishna an " avatar (incarnation) of the preserver-god, Vishnu in Hindu tradition. ChennaKesava literally means means "handsome Kesava" and is is a form of Hindu God Vishnu.
0 notes