A job interview with only one question? It happened, and it could happen to you! In this tutorial, we take a look at the question that was given and break down the logic for the answer. If you're just starting with Javascript, I suggest working through my full 8 hour video course on Javascript before this tutorial: czcams.com/video/EfAl9bwzVZk/video.html
I start watching video without any idea what is Pascal's Triangle after reading some docs here my solution: const factorial = (num) => (num === 0 ? 1 : num * factorial(num - 1)); const calc = (row, term) => factorial(row) / (factorial(term) * factorial(row - term)); const createTriangle = (num) => { const arr = []; for (let i = 0; i < num; i++) { let arrI = []; for (let j = 0; j
I'll repeat myself, but you should have 1MIllion subscribers. Your content is always great and so valuable. I can't get over why your numbers are still so low. Thanks a lot for your amazing job and you can bet that I'll make all I can to let others know about your wonderful channel.
Another awesome video to make my brain cells do some work :) And I have a question: is there any reason to explicitly parse our array values to integers if we put there only numbers in the first place? Or is it a precaution just in case of anything?
Long time since I looked at this video, but in general, it is always good to know the type of data you are working with. That's the idea behind TypeScript 🚀
Hello Dave, This is the third time trying to submit my comment but it's got deleted for some reasons. so here I am again, After reading a brief description about Pascal's Triangle I noticed two things: 1- In row 0 (the topmost row), there is a unique nonzero entry 1, so maybe we can initiate stackArray with [ [1] ] instead of an empty array (while condition must be adjusted) 2- Treating blank entries as 0 (when summing the two cells above), we can remove the if (!x || x === i - 1) and use the Nullish coalescing operator to replace blank cell values with 0, so all value will be calculated instead of hardcoding these For CSS, the square borders to the left/right sides of the triangle look thinner, if we add top/left margins of -1px to the squares we should be able to collapse the borders of consecutive squares I forked the code and applied those changes for easier code checking github.com/ahmad-511/one_question_interview I also added 'odd' class to squares with odd values so it shows the recursion pattern more easily, Thanks Dave,
Hi Ahmad, it is strange that your previous comments did not show up. I always welcome your comments and did receive their notifications, but as you note, when I went to CZcams to respond, the comments were not there. I'm glad I can respond to this one! 😀 I like your alternative suggestions. As always, great feedback my friend! 🙏🚀
@@DaveGrayTeachesCode That's really strange 🥴, but not as strange as my ISP is, I'm happy that I finally made it on the third time, Thanks for the great work my friend🏆
Forgot to say thanks for this video too ! How did you go about learning yourself as you mentioned you didn't have a CS degree either when you started in another video.
You're welcome! I plan to do a video on my background at some point, but I owned my own company and decided to "fix it myself" out of necessity. It got me started writing more than HTML and I discovered I really liked solving problems with code. Thanks for asking!
That's a great question 💯, and depending on who is conducting the interview, the time limit could vary greatly. I'll go on record as saying I am not in favor of a one question interview or even algorithm questions that do not allow you to use all resources that you would normally have available on the job to craft a solution. I Google topics and refer to MDN all the time in a normal day of work. Einstein said "Never memorize what you can look up." Given this interview was only one question, I hope they allowed the dev 30 minutes. If they wanted to create a pressure environment, they might have said 15. I'm just guessing at the time limit though. Very subjective overall.
A job interview with only one question? It happened, and it could happen to you! In this tutorial, we take a look at the question that was given and break down the logic for the answer. If you're just starting with Javascript, I suggest working through my full 8 hour video course on Javascript before this tutorial: czcams.com/video/EfAl9bwzVZk/video.html
I start watching video without any idea what is Pascal's Triangle after reading some docs here my solution:
const factorial = (num) => (num === 0 ? 1 : num * factorial(num - 1));
const calc = (row, term) => factorial(row) / (factorial(term) * factorial(row - term));
const createTriangle = (num) => {
const arr = [];
for (let i = 0; i < num; i++) {
let arrI = [];
for (let j = 0; j
Nice use of recursion and great solution! 🚀
I'll repeat myself, but you should have 1MIllion subscribers.
Your content is always great and so valuable.
I can't get over why your numbers are still so low.
Thanks a lot for your amazing job and you can bet that I'll make all I can to let others know about your wonderful channel.
Thanks again for the kind words. 🙏 Slow and steady growth with no viral video yet. That could change though! Thanks for the support! 💯🚀
Bro you are actually the best Javascript / coding content creator on CZcams right now...keep up the awesome work!
Thank you John! 💯
learned so much Dave keep it up
Awesome as always 👍😀
Thanks! 🙏
Another awesome video to make my brain cells do some work :) And I have a question: is there any reason to explicitly parse our array values to integers if we put there only numbers in the first place? Or is it a precaution just in case of anything?
Long time since I looked at this video, but in general, it is always good to know the type of data you are working with. That's the idea behind TypeScript 🚀
Hello Dave,
This is the third time trying to submit my comment but it's got deleted for some reasons. so here I am again,
After reading a brief description about Pascal's Triangle I noticed two things:
1- In row 0 (the topmost row), there is a unique nonzero entry 1, so maybe we can initiate stackArray with [ [1] ] instead of an empty array (while condition must be adjusted)
2- Treating blank entries as 0 (when summing the two cells above), we can remove the if (!x || x === i - 1) and use the Nullish coalescing operator to replace blank cell values with 0, so all value will be calculated instead of hardcoding these
For CSS,
the square borders to the left/right sides of the triangle look thinner, if we add top/left margins of -1px to the squares we should be able to collapse the borders of consecutive squares
I forked the code and applied those changes for easier code checking github.com/ahmad-511/one_question_interview
I also added 'odd' class to squares with odd values so it shows the recursion pattern more easily,
Thanks Dave,
Hi Ahmad, it is strange that your previous comments did not show up. I always welcome your comments and did receive their notifications, but as you note, when I went to CZcams to respond, the comments were not there. I'm glad I can respond to this one! 😀
I like your alternative suggestions. As always, great feedback my friend! 🙏🚀
@@DaveGrayTeachesCode That's really strange 🥴, but not as strange as my ISP is,
I'm happy that I finally made it on the third time,
Thanks for the great work my friend🏆
So helpful
Forgot to say thanks for this video too ! How did you go about learning yourself as you mentioned you didn't have a CS degree either when you started in another video.
You're welcome! I plan to do a video on my background at some point, but I owned my own company and decided to "fix it myself" out of necessity. It got me started writing more than HTML and I discovered I really liked solving problems with code. Thanks for asking!
@@DaveGrayTeachesCode That's fantastic !! Thanks for getting back to me, always good to hear about your background, and I love how you teach !
super!
best teacher !
Thank you! 🙏💯
So how long would you give the interviewee to solve this?
That's a great question 💯, and depending on who is conducting the interview, the time limit could vary greatly. I'll go on record as saying I am not in favor of a one question interview or even algorithm questions that do not allow you to use all resources that you would normally have available on the job to craft a solution. I Google topics and refer to MDN all the time in a normal day of work. Einstein said "Never memorize what you can look up." Given this interview was only one question, I hope they allowed the dev 30 minutes. If they wanted to create a pressure environment, they might have said 15. I'm just guessing at the time limit though. Very subjective overall.