All Questions
33 questions
1
vote
1
answer
113
views
Shrink an array of double elements (uniformly)
Is there a way to avoid the first loop in the method shrink? (if and while...)
The utility ...
1
vote
2
answers
345
views
Count the number of mismatches between two arrays
This function may compute the amount of unequal elements of two char-arrays of the length n:
...
1
vote
2
answers
3k
views
Add Properties from one array of Objects to another array of Objects based on property id
I do have my code running but again I'm wondering if there is a nicer solution since mine seems to be clumsy and I'm wondering if there is a better way like chaining (but I can't work out how to do ...
11
votes
4
answers
3k
views
Restructuring JSON to create a new JSON where properties are grouped according to similar values
I have a JSON structure in the following example format:
...
6
votes
1
answer
364
views
JavaScript: A drawing program in OOP
I made a little drawing program in OOP.
The game consists of a canvas which is basically a 2d array where the user can draw various shapes on it. There can be multiple shapes overlapped on top of each ...
4
votes
2
answers
310
views
Maxcounters in JavaScript
I am trying to solve this question: MaxCounters.
Solving it is straightforward, but solving it fast enough is proving very difficult. How can I improve the performance of this code? At the moment it ...
2
votes
2
answers
170
views
Divide the last element in an array of arrays among the remaining elements
The function below is part of an overall chunk of code to partition an array of size M into sub-arrays of size N. The function in question is written to handle the case: what if M isn't divisible by ...
1
vote
1
answer
61
views
4
votes
4
answers
3k
views
Forming error messages from a multidimensional associative array
I'm working with an input array, which is 3 levels deep, and creating error message strings accordingly in a separate output array. Below is the code.
...
2
votes
2
answers
292
views
A Java Iterable over multiple arrays
GlueArrays is used for iterating over an array of arrays, and it looks like this:
Main.java
...
2
votes
2
answers
1k
views
Iterating through two objects with different structures in parallel
I have two objects, one input = Array<Type> and one stored = Array<{..., Type}>
What's the best (cleanest) way to ...
3
votes
3
answers
321
views
Check if a postcode is in a list
I'm looking for improvement / advice / reviews on how I can improve this code. I feel like there is a better way or more efficient way of doing this and I am over looking it.
The Plugin I made is ...
1
vote
1
answer
96
views
Merging and summing multi-dimensional arrays
I've found myself today really struggling with this subject and I'm pretty sure that there must be a better way to do this.
First of all my arrays have the same layout, I need to merge them and sum ...
1
vote
4
answers
743
views
Find value that occurs in odd number of elements
I am trying to solve the following exercise using Javascript:
A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be ...
5
votes
1
answer
1k
views
Check if two date ranges overlap by X minutes
I have a list of volunteer shifts. The shifts are time ranges- for example, 9AM-2PM and 12PM-5PM. I need to check by how many minutes multiple selected shifts overlap, and then throw an error if the ...