1. Ninja And The Fence Problem Statement Ninja is given a task of painting a fence with ‘N’ posts using ‘K’ different colors. The task requires that not more than two adjacent posts have the same color. Your goal is to determine the number of ways to paint the fence, reporting each result modulo 109 + 7. Example: Input: N = 3, K = 2 Output: 6 Explanation: If the colors are numbered as 0 and 1, the fence with 3 posts can be painted in 6 ways: 110, 001, 101, 100, 010, and 011. Input: The first line contains an integer ‘T’, representing the number of test cases.Each test case includes two integers, ‘N’ and ‘K’, representing the number of posts and colors, respectively. Output: Print the number of valid ways (modulo 109 + 7) for each test case on a separate line. Constraints: 1 <= T <= 10 1 <= N <= 105 1 <= K <= 105 Time Limit: 1 sec Note: You are not required to print anything. Implement the function and return the answer.
2. What is the event loop in JavaScript?
3. What is the angle between the minute and hour hand at 1:15?
4. sell me pen? I want to replace the screen of my phone as it is broken, now try to convince me to buy a new phone in place of replacing the screen of my old phone
Browse through a variety of job opportunities tailored to your skills and preferences. Filter by location, experience, salary, and more to find your perfect fit.
We have sent an OTP to your contact. Please enter it below to verify.