Showing 3 of 12 questions
Determine if a number is a 'happy number'. A happy number eventually reaches 1 when replaced by the sum of the squares of its digits, repeating the process until it does.
#1. Happy Number
You're given a flowerbed represented by an array of 0s and 1s, where 0 means empty and 1 means planted. Determine if you can plant a given number of new flowers without violating the rule that adjacent plots cannot be planted.
#2. Can Place Flowers
Traverse a matrix diagonally, returning the elements in a specific zig-zag order. You'll need to manage the direction and boundaries to output the elements correctly.
#3. Diagonal Traverse
Page 1 of 1 · 12 total