This repository contains JavaScript coding examples, interview questions, and solutions. The goal is to help prepare for JavaScript-related technical interviews by practicing coding challenges and understanding basic concepts.
- Description: Explanation and examples of
call
,apply
, andbind
methods in JavaScript. - Usage: Demonstrates how to change the context (
this
) of a function using these methods.
- Description: A function to count the number of occurrences of each character in a string.
- Use Case: Useful for string manipulation questions in interviews.
- Description: Explanation of currying, a functional programming technique where a function is transformed into a sequence of functions, each taking a single argument.
- Example: Practical examples showing how currying can be used to break down functions into smaller, reusable ones.
- Description: A solution to find duplicate numbers in an array.
- Example: Covers different methods of finding duplicates, such as using sets and hash maps.
- Description: A function to compute the factorial of a given number using recursion and iteration.
- Example: Includes optimized solutions for factorial calculations.
- Description: A function to compute the GCD of two numbers using the Euclidean algorithm.
- Example: Shows how to use recursion to find the GCD efficiently.
- Description: A function to find both the maximum and minimum values in an array.
- Example: Covers multiple approaches, including sorting and using array methods.
- Description: Solutions for finding the missing value in an arithmetic progression (AP) array.
- Example: Uses mathematical formulas and loops to solve the problem.
- Description: A function to find the peak element (an element that is greater than its neighbors) in an array.
- Example: Demonstrates how to use binary search for optimal performance.
- Description: A function to calculate the sum of all elements in an array.
- Example: Uses array methods like
reduce
for summing values.
- Description: A function to reverse the elements in an array.
- Example: Covers both in-place and array copying techniques.
- Description: Solutions for sorting an array using different algorithms like quicksort, mergesort, and native JavaScript methods.
- Example: Highlights the time complexity of various sorting methods.
- Description: Various string manipulation questions, including reversing a string, checking for palindromes, and more.
- Example: Includes multiple techniques for solving common string problems.
- Description: Explanation and coding examples of JavaScript’s array methods:
map
,reduce
, andfilter
. - Usage: Shows how to use these methods for functional programming.
- Description: A solution to find the longest string in an array.
- Example: Demonstrates how to iterate over an array to find the longest string efficiently.
- Description: Functions to generate Fibonacci numbers using both recursion and iteration.
- Example: Includes optimized approaches for generating large Fibonacci sequences.
- Description: A function to check whether a given number is prime.
- Example: Includes optimized solutions for large numbers, using trial division and efficient loop bounds.
- Description: Explanation of the difference between
undefined
and variables that are not defined in JavaScript. - Example: Clarifies common interview questions about these terms.
Clone the repository:
git clone https://github.com/your-repo/javascript-coding-challenges.git