2400 Number of Ways to Reach a Position After Exactly k Steps | Zero to FAANG Kunal | Assignment
Vložit
- čas přidán 3. 09. 2022
- 2400 Number of Ways to Reach a Position After Exactly k Steps | Zero to FAANG Kunal | Assignment | Leetcode | Shapnesh Tiwari
Problem link :
leetcode.com/problems/number-...
Complete Java + DSA + Interview Preparation + CP Course
• Java + DSA + Interview...
Hi, thanks for watching our video about Arrays in Java
In this video we’ll walk you through:
- Brute Force
- Efficient approach
- Solution Code
TIMESTAMPS
Intro
Explanation begins
IDE solution
ABOUT OUR CHANNEL
Our channel is all about Programming. We cover lots of cool stuff such as solution to problems, concept explanation and tricks to master CP
Check out our channel here:
/ @programmerszone
Don’t forget to subscribe!
CHECK OUT OUR OTHER Playlists
GeeksforGeeks playlist:
• GeeksforGeeks problems
Complete C++ Course playlist:
• Complete C++ playlist
CodeChef Playlist:
• CodeChef Problems
HackerRank playlist:
• HackeRank problems
LeetCode problems
• Leetcode problems Solu...
FIND US AT
www.waadanibhao.wordpress.com
GET IN TOUCH
Contact us on hopesalivenow@gmail.com
2400. Number of Ways to Reach a Position After Exactly k Steps
Medium
86
35
Add to List
Share
You are given two positive integers startPos and endPos. Initially, you are standing at position startPos on an infinite number line. With one step, you can move either one position to the left, or one position to the right.
Given a positive integer k, return the number of different ways to reach the position endPos starting from startPos, such that you perform exactly k steps. Since the answer may be very large, return it modulo 109 + 7.
Two ways are considered different if the order of the steps made is not exactly the same.
Note that the number line includes negative integers.
Example 1:
Input: startPos = 1, endPos = 2, k = 3
Output: 3
Explanation: We can reach position 2 from 1 in exactly 3 steps in three ways:
- 1 - 2 - 3 - 2.
- 1 - 2 - 1 - 2.
- 1 - 0 - 1 - 2.
It can be proven that no other way is possible, so we return 3.
Example 2:
Input: startPos = 2, endPos = 5, k = 10
Output: 0
Explanation: It is impossible to reach position 5 from position 2 in exactly 10 steps.
#codechef #coding #python #hackerrank #programming #java #computerscience #coder #code #competitiveprogramming #machinelearning #pythonprogramming #algorithms #cpp #javascript #hackerearth #webdeveloper #geeksforgeeks #codinglife #leetcode #c #codeforces #engineering #codingmemes #programmer #hacker #programmingmemes #topcoder #webdevelopment #bhfyp #DSAwithKunal
What is your leetcode profile??
I thought normal sa channel hoga bt tum sach mai acha pdhare ho like striver love babbar you are doing great job you will get more subscriber in future for sure !
My coding profile :- shapnesht (on all platforms)
Thank you for your wishes and striver for me is an inspiration I'm not even 10% of what that man is.
Thank you for bringing smile on my face by commenting such a positive message :)
Great lecture Satayam
Than you bhaiya :)
*Bhaii Video Jaldi Jaldi Upload Karo Na 🥰♥️*
Sure bro :)
thanks bro mere se dp k quesiton nahi bante striver ka dp series dekha maine abhi kya kar sakta hu ki banne lage dp bhai
Bhai master kar recursion ko and socha kar thoda der repeating patterns nikala kar problems me aur ha agar hard questions nahi hote to chalta hai kayi baar solution dekhna and intuition samajhna chalta hai
@@ProgrammersZone ok bhai thanks