Skip to content

Instantly share code, notes, and snippets.

@wise-introvert
wise-introvert / learning-resources.md
Created August 13, 2024 12:24
List of links and resources to learn programming

Problem-Solving Skills Assessment:

Question

  • Can you describe a recent technical challenge you faced while working on a front-end project? How did you approach it, and what was the outcome?

Example answers

  • Recently, we encountered an issue where our application's performance was degrading significantly when handling a large amount of data. To address this, I conducted a thorough analysis of the codebase to identify any inefficient algorithms or data structures. After pinpointing the bottleneck, I optimized the data fetching process by implementing caching mechanisms and optimizing the algorithms for better time complexity. This not only resolved the performance issue but also improved the overall user experience.
  • In one of my recent projects, we faced a challenge where the application was crashing intermittently due to memory leaks. I began by conducting a detailed code review and identified areas where memory was not being properly managed, particularly in components with heavy state usage. I

Question

Imagine a sophisticated hierarchical data structure in JavaScript that models an organization's intricacies, encompassing details such as employee ID, name, position, department, and subordinates. Your task is to design a function, getEmployeesByPosition(organization, position) ( starting code is provided below ), which takes this organizational data structure as input along with a position ( e.g “Software Engineer” ) and efficiently produces an array containing information about all employees holding the given position within the organization. Your implementation should seamlessly navigate the complexity of the hierarchical data and deliver a clear and concise result. Either use JSPlayground as your environment or any online editor that you're comfortable with.

Organization object:

const organization = {
  id: 1,
  name: "Company",
  type: "Organization",
  employees: [
interface TreeNode {
capacity: number;
children: TreeNode[];
}
const findAverage = (node: TreeNode): number => {
let sum: number = 0,
count: number = 0;
let traverse = (node: TreeNode): void => {
/**
* @desc Day 5: Supply Stacks
* Expedition can depart once final supplies have been unloaded from ships
* Supplies are stored in stacks of marked crates and need to be rearranged
* Ship has cargo crane to move crates between stacks in planned steps
* Elves have a drawing of the starting stacks and rearrangement procedure
* Elves want to know which crate will be on top of each stack after rearrangement
* In example, top crates are C in stack 1, M in stack 2, and Z in stack 3
* Elves need to know which crate ends up on top of each stack
*
@wise-introvert
wise-introvert / worldcities.json
Last active January 23, 2023 20:39
A large json dataset to help stress test functions
This file has been truncated, but you can view the full file.
[
{
"admin_name" : "Tōkyō",
"capital" : "primary",
"city" : "Tokyo",
"city_ascii" : "Tokyo",
"country" : "Japan",
"id" : "1392685764",
"iso2" : "JP",
"iso3" : "JPN",
@wise-introvert
wise-introvert / README.md
Created December 30, 2021 00:54 — forked from grantland/README.md
NextBus API
1: Import the Standard Input Output library
3,4,5,6: Define four macros:
a. MAX_JUDGES
b. MAX_STRING
c. MAX_CONTESTANTS
d. WINNER_CUTOFF
8. Declare a struct called "Score" with the following datatypes:
a. "judgeScore": an array of doubles with a maximum capacity of 3
13. Declare a struct called "Contestant" with the following datatypes:
a. "name": an array of characters with a maximum capacity of 25
----------------------------------------------BUGS----------------------------------------------
======== BUG 1 ========
Original Line: 13, 16
Issue: Case-sensitive comparision of characters
What was done: Used the "tolower" function from the ctype library to convert both the characters being compared to lowercase
Original Code:
1. Import the standard input and output library
2. Import the String helper library
3. Define a macro called SZ and set it to 31
4. declare a character array of size "SZ" (31) called "str1" and set it to "Charlotte's"
5. declare a character array of size "SZ" (31) called "str2" and set it to "Spider's web"
6. declare a character array of size "SZ" (31) called "str3" and initialize it with one item: 0
7. Concatenate the value of str1 and the address of the value at index 9 in the str2 array using the strcat method provided by the string helper library
8. Compare the value of str1 with "Charlotte's web" using the strcmp method.
9. If the result from step 8 is false, execute the contents in the if block (since the condition is prepend with the not (!) operator ): copy the string "is the" to the value of str3
10. If the result from step 8 is true, execute the contents in the else block (since the condition is prepend with the not (!) operator ): copy the string "is not the" to the value of str3