Activity
Mon
Wed
Fri
Sun
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
What is this?
Less
More

Memberships

Software Developer Academy

Private • 20k • Free

Selftaught Developer Incubator

Private • 397 • $49/m

Developer Pro

Public • 144 • Free

Endless Evolution w/ Duffin

Private • 1.5k • Free

Team Anabolic Bodybuilding

Private • 56 • $39/m

Travis Media Community

Private • 109 • $27/m

24 contributions to Developer Pro
Level 6 Codewars
Suprised myself I passed this one. https://www.codewars.com/kata/5966847f4025872c7d00015b/train/javascript
12
12
New comment Apr 4
0 likes • Apr 4
function averageString(str) { if (!str.length) return 'n/a'; const strNumMap = new Map([ ['zero', 0], ['one', 1], ['two', 2], ['three', 3], ['four', 4], ['five', 5], ['six', 6], ['seven', 7], ['eight', 8], ['nine', 9], [0, 'zero'], [1, 'one'], [2, 'two'], [3, 'three'], [4, 'four'], [5, 'five'], [6, 'six'], [7, 'seven'], [8, 'eight'], [9,'nine'], ]); const strNums = str.split(' '); const hasAllDigits = strNums.every(str => strNumMap.has(str)); if (!hasAllDigits) { return 'n/a'; } const total = strNums.reduce((acc, curr) => { return acc + strNumMap.get(curr); }, 0); const average = Math.floor(total / strNums.length); return strNumMap.get(average); }
0 likes • Apr 4
@Duncan Whyte 🥹
Find the Longest Increasing or Decreasing Combination in an Array
function longestComb(arr, command){ const result = []; function backtrack(startIndex, currentComb) { console.log('currentComb', currentComb) if (startIndex >= arr.length - 1) { if (currentComb.length >= 3) { result.push(currentComb.slice()); } return; } else { if (currentComb.length >= 3) { result.push(currentComb.slice()); } } for (let i = startIndex; i < arr.length; i++) { if (!currentComb.length) { currentComb.push(arr[i]); backtrack(i + 1, currentComb); currentComb.pop() } else { if (command === '< <' || command === '<<') { if (currentComb.at(-1) < arr[i]) { currentComb.push(arr[i]); backtrack(i + 1, currentComb); currentComb.pop(); } } else if (command === '> >' || command === '>>') { if (currentComb.at(-1) > arr[i]) { currentComb.push(arr[i]) backtrack(i + 1, currentComb); currentComb.pop(); } } } } } backtrack(0, []); if (!result.length) { return result; } console.log(result) const mappedToLength = result.map(el => el.length); const longestLength = Math.max(...mappedToLength); const filteredResult = result.filter(el => el.length === longestLength); return filteredResult.length > 1 ? filteredResult : filteredResult[0]; } let arr = [-1, 3, -34, 18, -55, 60, 118, -64]; let comm = '< <'; console.log('#1', longestComb(arr, comm)); // [-1, 3, 18, 60, 118] arr = [-1, 3, -34, 18, -55, 60, 118, -64]; comm = '> >'; console.log('#2', longestComb(arr, comm)) // [3, -34, -55, -64]]); arr = [-26, 26, -36, 17, 12, 12, -10, -21]; comm = '< <'; console.log('#3', longestComb(arr, comm)) // [] arr = [ 36, 26, -26, -40, 12, 27, -56, 34, -55 ] comm = '> >'; console.log('#4', longestComb(arr, comm)) // [ [ 36, 26, -26, -40, -56 ], [ 36, 26, -26, -40, -55 ] ] arr = [ 45, 25, -19, 7, 46, -19, 36, -50, -57, 26, 46, 50, 20 ]; comm = '>>'; console.log('#5', longestComb(arr, comm)) // [ 45, 25, 7, -19, -50, -57 ]
3
1
New comment Apr 3
2 likes • Apr 3
I was able to figure it out, I did feel like the for loop was messing it up since it didn't make the recursive call on some conditions, but I haven't used backtracking like this in a while, but you can do back tracking like this without a for loop if (!currentComb.length) { currentComb.push(arr[i]); // this is where we take the current element backtrack(i + 1, currentComb); // since we took element we go to next index i + 1 currentComb.pop(); // base case hits and we want to now remove added element backtrack(i + 1, currentComb); // this is the decision where we decide not take el } if (command === '> >' || command === '>>') { if (currentComb.at(-1) > arr[i]) { // if condition is met currentComb.push(arr[i]); // we take element backtrack(i + 1, currentComb); // move to next element currentComb.pop(); // we return back from base case and remove item backtrack(i + 1, currentComb); // now skip element and move to next element } else { backtrack(i + 1, currentComb); // this case is for when we don't meet condition } } @Cristian Florea
Algo Interviews - Engineering Method
Why should I use the Engineering Method in algorithm interviews? 1. Our data shows that people perform better along these metrics when applying the Engineering Method. 2. People complete timed coding tests faster and pass all the test cases in fewer attempts than those who jump into coding and have to rewrite and debug complex code. 3. People complete interview questions faster and appear more competent to interviewers than those who write code without a clear direction. 4. There’s a strong correlation between better hiring outcomes and the number of steps they demonstrate to the interviewer. Behavioral component The human aspect of an interview introduces a need for clear and effective communication in each step of the problem-solving process to have a successful discussion. It's important to note that a successful interview often involves more than simply having a correct output. The interviewer is also interested in understanding your thought process and being confident that you have good judgement. That is to say, the journey is more important than the destination. To ensure that your solution and thought process are clearly understood, it's crucial to articulate them in a way that's easy for the interviewer to follow. Demonstrate independence and initiative by taking an active role in driving the conversation and efficiently moving through the problem-solving process. These behaviors are important factors in demonstrating your skills as an engineer. 🏴‍☠️ Explore Ask the interviewer enough questions to sufficiently clarify the problem before coming up with solutions. These questions can include the expected inputs & outputs of the abstract problem and concrete test cases. 👀 From the interviewer’s perspective They want to ensure that you fully understand an objective before addressing it. This step allows them to recognize your ability to resolve ambiguity. 💡 Tips 1. Come up with your own “happy case” examples When your interviewer starts the interview, they’ll typically provide some examples. Come up with at least one of your own examples, starting with the smallest and simplest. Then try to poke holes into your interviewer’s examples! The happy case here refers to a normal input that isn’t trying to test the edge cases of the question.
5
3
New comment Apr 2
1 like • Apr 2
@Daniel Yachnikov Hughes @Mioara Cenusa
0 likes • Apr 2
@Cristian Florea can't wait 🙌
Pro tip to help remember arguments vs parameters
I know a lot of people struggle with arguments and parameters, I know, I've been there too, I came across this tip a long time ago, and I thought it was useful. Arguments = Actual values Parameters = Placeholder values And we always pair are arguments with our parameters Also when you are defining the function is when we assign parameters (placeholders because we don't know what values will be passed in) When we invoke / actually use our function is when we actually pass in arguments (actual values) function addNums(a, b) { <== Parameters / Placeholder values return a + b; } addNums(3, 5) <== Arguments / Actual values Hope this helps, Cheers!
10
7
New comment Mar 31
1 like • Mar 31
@Florin Ghimici people do use them interchangeably so yeah it’s super confusing 😅
0 likes • Mar 31
@Harpreet Singh thanks, I’m glad you’re liking them 🙏
Pro tip to remember .unshift() vs .shift()
In case anyone has trouble remember the difference between unshift and shift. The way I remember it is that unshift is longer than shift, so unshift will make the array longer, so we add to the front of the array. And shift is shorter than unshift so it will shrink the array, so you remove the item from the front of the array. This applies for push / pop as well push is has more chars so it lengths the array, so it adds element to end of the array and pop is shorter so it removes item from the end of the array. Most people will remember push / pop since we use it so much and it's a little more intuitive, with method name. Hope this helps, Cheers 🙂
8
2
New comment Mar 31
1-10 of 24
Ronald Paek
4
41points to level up
@ronald-paek-8921
I aim to be a front-end engineer, driven by a passion for creating apps that enrich lives, teach tech, and honor my family.

Active 20d ago
Joined Mar 25, 2024
Los Angeles, CA
powered by