by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 14 22:38
    @bjorno43 banned @minitechtips_twitter
  • May 14 22:37
    @bjorno43 banned @real-action
  • Feb 01 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 27 2019 19:46
    @mstellaluna banned @zhonghuacx
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

Cristián Berríos
@crisberrios
or initialize the original array
Suzanne Atkinson
@AdventureBear
(not the whole code, just the loop part)
  for (i=0; i<numGroups; i++) {
    //place correct "size" of elements into each new group
    var multiArray[i]=[];
    for (j = 0; j<size; j++) {
       multiArray[i].push(arr[counter]);
       counter += 1; 
    }
  }
Sudeepto
@Sudeepto
@AdventureBear Can you give me the link of the problem ??
Cristián Berríos
@crisberrios
for (i = 0; i < numGroups; i ++) {
multiArray[i] = [];
}
Suzanne Atkinson
@AdventureBear
ugh I removed the var in my code above and I'm getting some partial success
Cristián Berríos
@crisberrios
it's missing [j]
also a way to initialize [i] before assigning [j]
Sudeepto
@Sudeepto

@AdventureBear Hey I have not reached that far yet, but as soon as I load the page, the console shows an error which was occurring due to extra parenthesis around the function call.

DId you noticed that ??

Suzanne Atkinson
@AdventureBear
well in the above case the j is just looping through the number of times to push, so I'm no longer using it in the definition.
Cristián Berríos
@crisberrios
well, that's right
Suzanne Atkinson
@AdventureBear
@Sudeepto yes I fixed that already, I think it's a small bug. @terakilobyte FYI
Cristián Berríos
@crisberrios
you don't need [j] in that case
Suzanne Atkinson
@AdventureBear
so I think I have my loops backwards.
again misunderstanding the original instructions
Cristián Berríos
@crisberrios
do you think?
let me check
Suzanne Atkinson
@AdventureBear
I'm not breaking up into n groups, I'm returning groups of n length
I was understanding the first. But I think the 2nd is what's wanted.
which addresses something you brought up, what to do with the remainder.
so I should be able to fill (n) spots of the first grouped array, then move to the next group, without needing to know how many groups there will be. Until I'm at the end of the first array.
like dealing cards in to a group of n people in a way. Round 1, round 2, oops, not enough for round 3...
I think i need a break!
Cristián Berríos
@crisberrios
I see what's the error
check how many groups are you doing for the failed test cases
Suzanne Atkinson
@AdventureBear
can you please tell me?
Cristián Berríos
@crisberrios
I thought it was checking only for whole groups, but you also need to return partial groups
Suzanne Atkinson
@AdventureBear
I run out of things to add in the failed test
right
Cristián Berríos
@crisberrios
and I told you to use Math.floor for the number of groups
Suzanne Atkinson
@AdventureBear
I'm going to go grab lunch, I think I need some calories. BRB
Cristián Berríos
@crisberrios
but...
Suzanne Atkinson
@AdventureBear
HAHAH
"told you so..."
Cristián Berríos
@crisberrios
it should be Math.ceil
since you want the upper number of possible groups
so if the division returns 1.5
you would want to have 2 groups
Sudeepto
@Sudeepto
@AdventureBear we need to split the array into a multidimensional array containing arrays of size size right ??
Cristián Berríos
@crisberrios
@Sudeepto did yo manage to make it 1 column?
Suzanne Atkinson
@AdventureBear
@Sudeepto yes I think that is correct. but there may be leftovers so either a) we don't know/care about how many there will be, just keep adding until we run out. or b) use @crisberrios suggestion for math.ciel to get the max number, knowing that the final one may not be filled
Sudeepto
@Sudeepto
@crisberrios Nope . I am fiddling with the css . :(
@AdventureBear my only doubt was whether it is provided or not whether size will be a multiple of len(arr) as the array element .
Cristián Berríos
@crisberrios
@Sudeepto nope, it might not be a multiple
Sudeepto
@Sudeepto
@AdventureBear Okay that means that the multi-dimensional array's last element ,can have less than size elements. Right ?? :)
Suzanne Atkinson
@AdventureBear
yes
yes, lat element less than size elements
Sudeepto
@Sudeepto
@AdventureBear I solved your problem :) Reply if you want help okay ??
Suzanne Atkinson
@AdventureBear
ooh yes pleeeeeze!!!