tekgrrl / coding_problems

0 stars 0 forks source link

Python Challenges

  1. Simple Calculator - Write a Python script that takes two numbers and a basic arithmetic operation (add, subtract, multiply, divide) as input and outputs the result.
  2. List Comprehensions - Use list comprehensions to generate a list of squares of the first 10 positive integers.
  3. File Operations - Read a text file, count the frequency of each word, and write the results to a new file.
  4. Decorator Function - Implement a decorator that measures the execution time of a function.
  5. Generators - Create a generator function that yields an infinite sequence of Fibonacci numbers.

C/C++ Challenges

  1. Memory Management - Write a C++ program that dynamically allocates an array of integers, modifies it, and then properly deallocates it.
  2. Class Inheritance - Implement a simple class hierarchy representing geometric shapes with methods to compute area and perimeter.
  3. Template Functions - Create a template function in C++ that can accept any numerical data type and return its square.
  4. Multithreading - Write a C++ program that uses multiple threads to parallelize a simple computational task, like calculating factorial of different numbers.
  5. Smart Pointers - Refactor a legacy C++ code that uses raw pointers to use smart pointers instead.

JavaScript/TypeScript Challenges

  1. DOM Manipulation - Create a simple HTML/CSS page and write JavaScript to dynamically change the content when a user clicks a button.
  2. Asynchronous Fetch - Use fetch to retrieve user data from a public API and display it on a webpage.
  3. TypeScript Interfaces - Define a TypeScript interface for a User object and write a function that takes a User object and logs a specific greeting.
  4. Promises and Async/Await - Convert a series of nested callbacks into clean code using Promises and then refactor it to use async/await.
  5. Functional Programming - Write a TypeScript function that takes an array of numbers and returns a new array containing only the numbers that are divisible by a given divisor, using functional programming concepts like filter.

Go Challenges

  1. Hello World API - Write a simple HTTP server in Go that responds to /hello route with a "Hello, World!" message.
  2. Goroutines and Channels - Implement a Go program that uses goroutines and channels to perform a concurrent calculation, such as summing the elements of an array.
  3. Interface Implementation - Define an interface for a vehicle, and implement it in different structs representing different types of vehicles.
  4. Error Handling - Write a Go program that opens a file and reads its contents, properly handling any errors that might occur using idiomatic Go error handling.
  5. Dependency Injection - Implement a simple dependency injection pattern in Go to manage dependencies in a small application.

Warm-up Challenges (1-5)

  1. C/ C++: Write a function that takes an integer n as input and returns the nth Fibonacci number.
  2. Python: Implement a simple calculator with basic arithmetic operations (+, -, *, /) using a dictionary-based approach.
  3. JavaScript/ TypeScript: Create a recursive function factorial that calculates the factorial of a given integer n.
  4. Go: Write a program that prints the first 10 prime numbers.

Medium-Challenge Zone (6-15)

  1. C/ C++: Implement a simple queue data structure using structs and pointers.

  2. Python: Write a function max_subarray_sum that takes an array of integers as input and returns the maximum sum of a subarray.

  3. JavaScript/ TypeScript: Create a class Graph with methods for adding edges, finding neighbors, and performing BFS/Dijkstra's algorithm.

  4. Go: Implement a simple chat server using TCP sockets.

  5. C/ C++: Write a function merge_sort that implements the merge sort algorithm for sorting an array of integers.

  6. Python: Implement a simple decision tree classifier using a dictionary-based approach.

  7. JavaScript/ TypeScript: Create a function binary_search that performs binary search on a sorted array of integers.

  8. Go: Write a program that calculates the average of three numbers entered by the user.

  9. C/ C++: Implement a simple stack data structure using structs and pointers.

  10. Python: Write a function flatten_list that takes an nested list as input and returns a flattened list.

  11. JavaScript/ TypeScript: Create a class HashTable with methods for adding key-value pairs, looking up values by key, and resizing the table.

Challenge Zone (16-20)

  1. C/ C++: Implement a simple heap data structure using structs and pointers.

  2. Python: Write a function find_closest_pair that takes an array of 2D points as input and returns the closest pair of points.

  3. JavaScript/ TypeScript: Create a function generate_random_walk that generates a random walk (sequence of random steps) on a graph with given nodes and edges.

  4. Go: Write a program that implements a simple priority queue using a binary heap.

  5. C/ C++ (or your choice): Implement a simple, command-line-based game like Tic-Tac-Toe or Hangman using the language of your choice.