PaulTreanor / coding-challenges

Public repo of coding challenges practice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

coding-challenges

Public repo of coding challenges practice

I'm trying out doing all the old fashioned interview coding questions in a browser based IDE (CodeSpaces). I just want to get a handle on how far along these environments are for developing in.

All coding challenges will be written in TypeScript. I'm going to make an effort to use Deno and Node and document how I feel about them all.

I'll also be using a test driven development approach to these tests.

I'm also going to be documenting all solutions in Solutions.md

Week 1: Basic Challenges

Day 1: Hello World

  • Write a function that prints "Hello, World!"
  • Write tests to ensure that the function correctly prints "Hello, World!"

Day 2: Sum of Two Numbers

  • Write a function that takes two numbers and returns their sum.
  • Write tests to ensure that it works as expected.

Day 3: Reverse String

  • Write a function to reverse a string.
  • Write tests for various cases including palindromes and empty strings.

Day 4: Check Palindrome

  • Write a function to check if a string is a palindrome.
  • Write tests for this function.

Day 5: FizzBuzz

  • Implement the classic FizzBuzz problem.
  • Write tests that check for 'Fizz', 'Buzz', and 'FizzBuzz'.

Day 6: Fibonacci Sequence

  • Write a function that returns the n-th Fibonacci number.
  • Write tests for this function.

Day 7: Factorial

  • Write a function to calculate the factorial of a given number.
  • Write tests to ensure the function works correctly.

Week 2: Data Structure Based Challenges

Day 8: Find Maximum in Array

  • Write a function that finds the maximum number in an array.
  • Write tests for this function.

Day 9: Array Average

  • Write a function that calculates the average of an array of numbers.
  • Write tests for this function.

Day 10: Remove Duplicates from Array

  • Write a function that removes duplicate values from an array.
  • Write tests for this function.

Day 11: Merge Sorted Arrays

  • Write a function to merge two sorted arrays into a new sorted array.
  • Write tests for this function.

Day 12: Linked List Operations

  • Implement basic operations for a singly linked list: insert, delete, search.
  • Write tests for these operations.

Day 13: Stack Operations

  • Implement a stack with methods push, pop, and peek.
  • Write tests for these methods.

Day 14: Queue Operations

  • Implement a queue with methods enqueue, dequeue, and peek.
  • Write tests for these methods.

Week 3: Intermediate Challenges

Day 15: Two Sum

  • Given an array and a target, find the indices of two numbers that add up to the target.
  • Write tests for this function.

Day 16: Find Minimum in Rotated Sorted Array

  • Write a function to find the minimum element in a rotated sorted array.
  • Write tests for this function.

Day 17: Longest Substring Without Repeating Characters

  • Write a function to find the length of the longest substring without repeating characters.
  • Write tests for this function.

Day 18: Valid Parentheses

  • Write a function to validate if the input string has valid open and close parentheses.
  • Write tests for this function.

Day 19: Maximum Subarray

  • Write a function to find the contiguous subarray with the largest sum.
  • Write tests for this function.

Day 20: Implement strStr()

  • Implement the strStr() function to locate a substring within a string.
  • Write tests for this function.

Day 21: Anagrams

  • Write a function to check if two strings are anagrams of each other.
  • Write tests for this function.

Experiment review

I really like GitHub CodeSpaces.

As a VSCode user I find that it genuinely works near seemlessly. I was honestly surprised because I've used codeSandbox in the past and I wasn't that impressed.

I did have an issue where syntax highlighting wasn't working but changing my theme to Light(Visual Studio) fixed that. I also ran into a pretty typical ESLint not working issues that VSCode also sometimes has but reloading the page actually helps.

I appreciate not having to clone a repo and have such a neatly organised environment on my Mac.

I also appreciate that CodeSpaces encourages you to always commit your code or else they'll keep your CodeSpace active, which costs a small fee.

About

Public repo of coding challenges practice


Languages

Language:TypeScript 92.2%Language:JavaScript 7.8%