Тёмный

JavaScript interview questions (Count Boomerangs In Array )  

itsCodingDoctor
Подписаться 12 тыс.
Просмотров 1 тыс.
50% 1

JavaScript interview questions 🔥 Count Boomerangs In Array #reactinterviewquestions #javascriptinterviewquestions #reactjs #programming #coding
Please checkout below playlists:-
1. DAILY ONE REACT INTERVIEW QUESTION
• Daily React Interview ...
2. MNC INTERVIEW EXPERIENCES
• MNC Interview Experiences
3. TRICKY CSS QUESTIONS/DESIGNS
• Tricky CSS
4. MERN PROJECTS FROM SCRATCH
• MERN Projects
5. REACT IMPORTANT/RANDOM TOPICS
• React Topics
ReactJs Interview
React/Redux Coding Interview
Frontend Interview
javascript interview questions
reactjs interview questions and answers for experienced
advanced reactjs interview questions.
Please subscribe to my channel. Like, share and subscription = 100% MOTIVATION
I hope you enjoy my channel videos!
Coffee:- www.buymeacoffee.com/itsCodin...
Follow On Twitter:- @itscodingdoctor
Instagram:- / itscodingdoctor

Опубликовано:

 

15 авг 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@g.pavani5275
@g.pavani5275 Год назад
Very nice explanation bro it's really awesome ....waiting for regular videos to get uploaded in this interview series of JS
@itscodingdoctor
@itscodingdoctor Год назад
Thanks 😊
@coder0015
@coder0015 Год назад
Started learning JS recently. loved to watch this video, I literally want more of these!!
@itscodingdoctor
@itscodingdoctor Год назад
Great. You can find 23 more questions in this series
@nittasreenivas4043
@nittasreenivas4043 Год назад
please solve this question alternating positive and negative number in js input:[9,4,-2,-1,5,0,-5,-3,2] output:[9,-2,4,-1,5,-5,0,-3,2]
@itscodingdoctor
@itscodingdoctor Год назад
Sure. Will create a video
@nitinsoni9956
@nitinsoni9956 Год назад
At first the solution seems very simple but when I tried it damn it was tricky. Solved it by first finding indices of negative and positive numbers than using simple loop and finding the lower bounds length and upper bounds of respected arrays assigned the indices to new array and lasted compared which array is bigger and assigned remaining indices from that array.
@nitinsoni9956
@nitinsoni9956 Год назад
let arr = [9, 4, -2, -1, 5, 0, -5, -3, 2,-2,2,3,3]; // pArr => positive indices nArr=> negative indices let pArr = arr.map((el, i) => (el >= 0 ? i : " ")).filter((el) => el !== " "); let nArr = arr.map((el, i) => (el < 0 ? i : " ")).filter((el) => el !== " "); // to store the new alternate numbers let alArr = []; // bb & lb => higher bound & lower as one of two arrays can be bigger hence we have to loop till bigger array length let bb = pArr.length > nArr.length ? pArr.length : nArr.length; let lb = pArr.length < nArr.length ? pArr.length : nArr.length; let pi=0,ni=0; for (let i = 0; i < bb; i++) { // as till lower bound both positive and negative indices array would have same number of elements if(lb > i){ alArr.push(arr[pArr[pi]]); alArr.push(arr[nArr[ni]]); pi++;ni++; } else{ // as positive array is bigger remaing numbers would be added from this array if(pArr.length > lb){ alArr.push(arr[pArr[pi]]); pi++; } // as negative array is bigger remaing numbers would be added from this array else{ alArr.push(arr[nArr[ni]]); ni++; } } } console.log(alArr);
@nittasreenivas4043
@nittasreenivas4043 Год назад
@@nitinsoni9956 thankyou bro for helping out i just tried like this let arr = [9, 4, -2, -1, 5, 0, -5, -3, 2,-2,2,3,3] let positive = arr.filter((num) => { return num >= 0; }) let negative = arr.filter((num) => { return num < 0; }) let result = []; for(let i=0,j=0; i
@nitinsoni9956
@nitinsoni9956 Год назад
@@nittasreenivas4043 You're welcome and there was always room for improvement in my code. I'm looking forward how codingDoctor solves the given problem.
@nitinsoni9956
@nitinsoni9956 Год назад
I love this series but I guess the difficulty level was not hard as it was kind of easy question. I solved the question with the exact solution that was shown in the video.
@itscodingdoctor
@itscodingdoctor Год назад
Happy to hear that you could solve it yourself. It's a hard question though. But anyone having good knowledge of javascript can solve this.
@itscodingdoctor
@itscodingdoctor Год назад
I'll keep on increasing the difficultly level
@sakthiii711
@sakthiii711 Год назад
Nice video for new topic bro, Please can you make video for [1,2,3,4,5] this will come to X pattern cross method .this was my interview question i don't know how to solve this problem.
@itscodingdoctor
@itscodingdoctor Год назад
Thanks
@itscodingdoctor
@itscodingdoctor Год назад
I couldn't understand this properly
@itscodingdoctor
@itscodingdoctor Год назад
Can you give me the input and expected output? I'll try to solve and create a video too
Далее
Победитель евровидения
00:18
Просмотров 20 тыс.
Победитель евровидения
00:18
Просмотров 20 тыс.