https://github.com/bytangle/ktest211
https://github.com/bytangle/ktest211
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bytangle/ktest211
- Owner: bytangle
- Created: 2025-06-24T09:48:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-24T09:51:57.000Z (about 1 year ago)
- Last Synced: 2025-08-07T15:54:00.734Z (11 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Use https://www.typescriptlang.org/play to answer the questions.
## 1. Nested Object Flattening
**Problem:**
Write a function to flatten a deeply nested JavaScript object into a single-level object with dot-separated keys.
### Example
```ts
Input:
{
a: {
b: {
c: 5
}
},
d: 10
}
Output:
{
"a.b.c": 5,
"d": 10
}
```
## 2. Find Missing Number
**Problem:**
You are given an array of `n` unique integers where each integer is between `1` and `n+1` (inclusive), but one number is missing. Return the missing number.
Your solution should run in **O(n)** time and **O(1)** space.
---
### Example 1
**Input:**
`[1, 2, 4, 5, 6]`
**Expected Output:**
`3`
---
### Example 2
**Input:**
`[2, 3, 4, 5, 6, 7, 8]`
**Expected Output:**
`1`
## 3. String Permutation Validator
**Problem:**
Write a function that checks whether two strings are permutations of each other.
Two strings are permutations if they contain the same characters with the same frequency, in any order.
---
### Example 1
**Input:**
`"listen", "silent"`
**Expected Output:**
`true`
---
### Example 2
**Input:**
`"hello", "world"`
**Expected Output:**
`false`