Coding Challenge #6: Array Rotation JavaScript Coding Challenge For Beginners
Vložit
- čas přidán 7. 09. 2024
- Please like, share and subscribe if you find the video useful.
Checkout the Playlists:
👉 FrontEnd JavaScript Interview Questions: • #4 JavaScript Intervie...
👉 JavaScript Tutorials:
• Difference Between var...
👉 Essentials for Web developers:
• How Does the Browser C...
👉 React Hooks & Latest concepts:
• Rules of Hooks In Reac...
👉 HTML Tutorials:
• WebStorage APIs Sessio...
👉 CSS Tutorials:
• How Does CSS Work | Th...
👉 Coding Challenges:
• Coding Challenge #5: A...
👉 Best Practices & Common mistakes:
• Best Practices of Usin...
👉 React js for Beginners:
• Why To Use JSX in Reac...
👉 Things To Know As JavaScript/FrontEnd Developer:
• Things To Know As Java...
LIKE | SHARE | SUBSCRIBE 😊
#javascript #reactjs #react #webdevelopment #frontenddevelopment #uidevelopment
#javascriptinterviewquestions #interviewquestions #codingchallenges
👇👇👇
Follow me on
Telegram: t.me/+HTxs0I-J...
Instagram: / rethinkingui
Twitter: / suresh9058
LinkedIn: / suresh-mende-a1a20459 - Věda a technologie
you explained the method by using splice wonderfully, its really pleasure to learn with you thank you
for the first approach in leetcode it is showing the error of TLE(Time Limit Exceed)
and for 2nd it will fail in the below scenario.
take these inputs
let arr = [1,2];
let k = 5;
expected O/p is [2,1]
actual O/P is [1,2]
use k = k % arr.length
Very well explained
Thank you for the detailed solution.
Your welcome
Thanks bro
Please Do Like Share And Subscribe...🙂🙂🙂
Explained Well.
Thank You
Thank u Jtech
Hi, when I use the 2nd solution with splice, the test case arr = [1,2] arrayRotation = 1, it fails and I am not sure why.
It's because when you see and k is longer than nums you will get a negative value and be trying to delete values at an index that doesn't exist.
This video is from May 2021 and Leet Code must have updated the problem with some new test cases.
A very good explanation. Thanks buddy!
Thank u
@@RethinkingUI could you please explain rotate array not using pop and other methods. Instead, only using while loop and for loops. And saving in temp variable.
@@RethinkingUI I mean, help me understand the following code.
let arr=[1,2,3,4,5,6,7];
let k=3;
let count=0;
let val=arr[0];
let rep=0;
let i=0;
while(count
Very well explained brother
Thank you
Thanks bhai
Can you tell me the methods for rotating it in left direction (to last position of an array).
Try Array shift method
@@RethinkingUI yes it worked array.push(array.shift());
Thanks i understand this rotation array logics. Very simple
sahi dimaag lagaya bhai.
Thank you
thank u bro but how to solve without inbuilt function ?
Why the console final output is underfined.
final output console is the console which we are calling the function. As that function not returning anything. We got the final console output as undefined. In fact we no need to put the function call in the console log.
@@RethinkingUI yes after i return the function i got solved
Nice concept
Thank you
Thank you