Even & Odd Using Bit Manipulation | LeetCode Problem | Lecture 2
π₯ **Bit Manipulation Lecture 2 β Even & Odd (LeetCode Problem)** In this video, we solve a **LeetCode problem** to check whether a number is **Even or Odd using Bit Manipulation**. This is one of the most important tricks for **DSA, Coding Interviews, and Competitive Programming**. π‘ Instead of using `% 2`, we use a faster **bitwise trick (n & 1)**: * Even β n & 1 = 0 * Odd β n & 1 = 1 --- π **Topics Covered:** * What is Bit Manipulation * Even & Odd using Bitwise AND (&) * How (n & 1) works internally * Time Complexity Optimization * Java Code Implementation --- π» **Code (Java):** ```java public class EvenOdd { public static void main(String[] args) { int n = 7; if ((n & 1) == 0) { System.out.println("Even"); } else { System.out.println("Odd"); } } } ``` --- π **Why this is important?** Bit manipulation is widely used in: * LeetCode Problems * FAANG Interviews * Competitive Programming --- π **Playlist (Bit Manipulation Series):** Lecture 1 β Introduction Lecture 2 β Even & Odd (This Video) --- π Like, Share & Subscribe for more DSA content! π **Channel:** Code with Rahul Kumawat --- #BitManipulation #LeetCode #DSA #CodingInterview #Java #EvenOdd #Programming
Download
0 formatsNo download links available.