Skip to content

Instantly share code, notes, and snippets.

View ahsanhabibleon's full-sized avatar

Mohammad Ahsan Habib ahsanhabibleon

View GitHub Profile

Senior Frontend Interview Questions

Some questions about frontend development that might be in your next job interview. The questions were formulated by @mauvieira, a super senior fullstack developer

General Frontend

  • What are the strategies we can use to optimize the performance of web applications?

    • CDNs, GraphQL (maybe) to reduce overfetching, improve backend performance, use SSR and/or SSG, lazy loading for loading assets only when it's needed, minimize and compress HTML, CSS and JS files, and optimize images by compressing and resizing them.
  • What are Web Vitals (LCP, FID, CLS)? And how are they applied in the real world?

@ahsanhabibleon
ahsanhabibleon / assignment_on_array.js
Created August 7, 2023 17:27
Ostad cracking coding interview: assignment on array
function findMaxProfit(prices) {
const minPrice = Math.min(...prices)
const nextIndexOfBuyingDay = prices.indexOf(minPrice) === prices.length - 1 ? prices.indexOf(minPrice) : prices.indexOf(minPrice) + 1
if(nextIndexOfBuyingDay === prices.length) {
return 0
}else {
return Math.max(...prices.slice(nextIndexOfBuyingDay, prices.length)) - minPrice
}
}
@ahsanhabibleon
ahsanhabibleon / Ostad_cracking_coding_interview_assignment_1.js
Last active July 30, 2023 18:34
Ostad_cracking_coding_interview_assignment_1
// using `formula` (time complexity O(1), space complexity O(1))
function sum_of_natural_numbers(n) {
return (n * (n + 1)) / 2;
}
// using `for` loop (time complexity O(n), space complexity O(1))
function sum_of_natural_numbers_using_for_loop(n) {
let SUM = 0;
for (let i = 0; i <= n; i++) {