Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Tobias Grothe's user avatar
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: ...
HeapUnderStop's user avatar
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 ...
BreadcrumbPie's user avatar
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: ...
fruitlessartery's user avatar
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 ...
Joji's user avatar
  • 335
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 ...
jackdaw's user avatar
  • 143
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 ...
Paul Gowder's user avatar
1 vote
1 answer
61 views

converting object of arrays to an array of objects in a desired format

...
Vignesh Sharma's user avatar
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. ...
knot22's user avatar
  • 469
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 ...
coderodde's user avatar
  • 31.3k
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 ...
bxk21's user avatar
  • 123
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 ...
Second2None's user avatar
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 ...
ccb123g's user avatar
  • 11
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 ...
Anirban Bera's user avatar
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 ...
RedDragonWebDesign's user avatar

15 30 50 per page