All Posts

Leetcode 593: Valid Square

Given four points in a 2D space, determine if these points form a valid square. The points are not necessarily provided in any particular order.

Leetcode 633: Sum of Square Numbers

Given a non-negative integer c, determine if there exist two non-negative integers a and b such that a^2 + b^2 = c.

Leetcode 640: Solve the Equation

Given an equation with a variable ‘x’ and basic arithmetic operations (’+’, ‘-’), find the value of ‘x’. The equation might have a solution, no solution, or infinite solutions. Your task is to return the correct result in the form of a string.

Leetcode 667: Beautiful Arrangement II

Given two integers n and k, construct a list of n different positive integers from 1 to n such that the absolute differences between consecutive elements contain exactly k distinct integers. Return any valid solution.

Leetcode 670: Maximum Swap

You are given an integer num, and you can swap two digits at most once to get the largest possible number. Return the maximum number that can be obtained after performing the swap.

Leetcode 672: Bulb Switcher II

You are in a room with n bulbs, all initially turned on. There are four buttons on the wall, each with a different functionality: flip all bulbs, flip even-numbered bulbs, flip odd-numbered bulbs, and flip bulbs with labels j = 3k + 1. You need to make exactly presses presses. For each press, you can choose any button. Return the number of distinct possible configurations of the bulbs after performing all the presses.