202. Happy Number
[Happy Number - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/happy-number/)
[Happy Number - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/happy-number/)
[Power of Three - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/power-of-three/)
class Solution:
def maxProfit(self, prices: List[int]) -> int:
stack = []
answer = 0
for price in prices:
if not stack:
stack.append(price)
else:
if stack[-1] < price:
answer+=price-stack[-1]
stack.pop()
stack.append(price)
else:
stack.pop()
stack.append(price)
return answer

[Kth Smallest Element in a Sorted Matrix - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/)
[Game of Life - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/game-of-life/)
[Number of 1 Bits - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/number-of-1-bits/)
[Convert Sorted Array to Binary Search Tree - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/)
[Longest Increasing Subsequence - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/longest-increasing-subsequence/)