Skip to content

Conversation

miorel
Copy link
Contributor

@miorel miorel commented Sep 1, 2024

No description provided.

@miorel miorel changed the title Write-up for problem 2677. Chunk Array [DRAFT] Write-up for problem 2677. Chunk Array Sep 1, 2024
@miorel miorel force-pushed the chunk-array-writeup branch 5 times, most recently from 9d8652f to ab49164 Compare September 2, 2024 18:23
@miorel miorel force-pushed the chunk-array-writeup branch from ab49164 to dae571b Compare September 2, 2024 18:38
@miorel miorel marked this pull request as ready for review September 2, 2024 18:50
@miorel miorel changed the title [DRAFT] Write-up for problem 2677. Chunk Array Write-up for problem 2677. Chunk Array Sep 2, 2024
Copy link
Contributor

@elimanzo elimanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the write up! I Really enjoyed reading about Type generics, and the intro of streaming.

Going back to my first round of writing this solution again, I definitely had a solution similar to Processing Individual Elements before the streaming (When you mentioned "most folks adopt an algorithm similar to this one". I was like I'm called out 😂). Using it looks so much more concise an elegant 😄.

Comment on lines +279 to +290
To really rub it in, since the interface LeetCode is asking for is the same as the interface from Lodash, we can simply define a `chunk` variable that's _equal_ to the Lodash function. [Object destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#object_destructuring) makes this really fun:

[View submission on LeetCode](https://leetcode.com/problems/chunk-array/submissions/1375885828/)

```javascript []
/**
* @param {Array} arr
* @param {number} size
* @return {Array}
*/
const { chunk } = _;
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love seeing you troll LeetCode 😂

@miorel miorel merged commit fe0b554 into main Sep 2, 2024
6 checks passed
@miorel miorel deleted the chunk-array-writeup branch September 2, 2024 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants