Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about array-algorithms

Read more about array-algorithms

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - array-algorithms

How to generate row-wise permutations of a 2d Array?

I recently got this question (paraphrased below) in a practice interview test and it still stumps me: Given a 2d array A, generate a list of row-wise 1d array permutations from it. A = [ [1], ...
test-img

polarSyndicate

algorithm

structure

array-algorithms

Votes: 0

Answers: 2

Latest Answer

You're really just permuting the row order, and then flattening the matrix for each permutation. Python example: from itertools import chain, permutations def flatten(matrix): return list(chain(*...
test-img

Dillon Davis

find maximum GCD of an array of triplets

you are given an array of triplets of size N, we have to choose one number from each triplet, forming a new array of N size, such that the GCD of the numbers in the new array is maximum. example: an a...
test-img

ayushi

algorithm

data-structures

number-theory

greatest-common-divisor

array-algorithms

Votes: 0

Answers: 1

Latest Answer

I think you can maintain a list of possible gcds. If the first triple is (a0, a1, a2), you start with set(a0, a1, a2). Then for the second triple (b0, b1, b2) you take the gcd of each element with eve...
test-img

Paul Hankin

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved