0 likes | 14 Views
ud83dude80 ud83cudf1f Day 4 of DSA Mastery ! Enhance your coding expertise guided by HeyCoach's industry experts.
E N D
30 DAYS DSA ROADMAP Swipe for more >
DAY 4 Maths Power of Two Difficulty – Easy Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2^x. Example 1: Input: n = 1 Output: true Explanation: 2^0 = 1 Example 2: Input: n = 16 Output: true Explanation: 2^4 = 16 Example 3: Input: n = 3 Output: false
Divide Two Integers Difficulty – Medium Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. The integer division should truncate toward The integer division should truncate toward zero, which means losing its fractional part. Example: Input: dividend = 10, divisor = 3 Output: 3 Explanation: 10/3 = 3.33333.. which is truncated to 3. Problem link
Pow(x,n) Difficulty – Medium Implement pow(x, n), which calculates x raised to the power n (i.e., x^n). Example 1: Input: x = 2.10000, n = 3 Output: 9.26100 Example 2: Input: x = 2.00000, n = -2 Output: 0.25000 Explanation: 2^(-2) = 1/2^2 = 1/4 = 0.25 Problem link
Permutation Sequence Difficulty - Hard The set [1, 2, 3, ..., n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get the following sequence for n = 3: "123" "123" "132" "213" "231" "312" "321" Example 1: Input: n = 3, k = 3 Output: "213" Example 2: Input: n = 4, k = 9 Output: "2314" Problem link