# Questions tagged [array-manipulation]

A competition to solve a particular problem through the usage and manipulation of arrays.

533 questions
Filter by
Sorted by
Tagged with
807 views

### Cartesian LCM of two arrays

Given two nonempty arrays of natural numbers $a$ and $b$, return the shortest nonempty array of pairs of natural numbers $q$ such that the sequence of first elements of $q$ consists of a whole ...
161 views

### Simulate move left for 2048 [duplicate]

I have a fixed length vector of 4 elements. The inputs of which are always 0 or 2^n for n = 1 to 15 (so n = 0 excluded i.e. 2^0 = 1 will not appear) ...
2k views

271 views

### Maximum summed sub sequences with no two numbers sharing the same digit [closed]

Suppose there are 5 positive integers in an array or list as 14, 12, 23, 45, 39. 14 and 12 cannot be taken in the subset as 1 is common in both. Similarly {12, 23}, {23, 39}, {14, 45} cannot be ...
2k views

### Split into three!

Given a string, you've to split it into groups of three characters (by padding _ at the end). Related, but still it's different. Sample I/O: ...
303 views

Background Ada is a programming language that is not exactly known for its terseness. However, its array literal syntax can in theory allow for fairly terse array specifications. Here is a simple ...
681 views

### Determine if a grid contains another grid

Challenge Create a function takes in two 2-dimensional arrays of Characters (or Strings if the programming language does not have characters as a datatype) as inputs: a and b. If your language does ...
427 views

So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have ...
1k views

### Enumerate Derangements

Given some positive integer $n$ generate all derangements of $n$ objects. Details A derangement is a permutation with no fixed point. (This means in every derangement number $i$ cannot be in ...
251 views

### Map values to any multidimensional array [closed]

Codegolf challenge - mapping values in a multidimensional array [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ] This 2D array is sick of being so false, and wants to ...
2k views

### Maximum summed subsequences with non-adjacent items

Introduction: Inspired by these two SO questions (no doubt from the same class): print the elements in the subarray of maximum sum without adjacent elements java and Maximum sum of non adjacent ...
1k views

### Slither Like a Snake

The Idea We've done matrix spirals before, and full rotations, and even diagonal rotations, but not, as far as I can find, snake rotations! What is a snake rotation? Imagine the rows of a matrix ...
501 views

### Reorder a Master List Based on a Reordered Subset

I recently had a problem to solve at work where I had two lists: a master list, and a smaller list that contains a subset of the items in the master list potentially in a different order. I needed to ...
711 views

### Consistent Overhead Byte Stuffing (COBS)

I'm surprised this hasn't been posted before! The Consistent Overhead Byte Stuffing (COBS) algorithm is used to delimit byte streams. We choose a frame marker (we'll use 0x00) and wherever 0x00 ...
2k views

### Rotate a column

Given an integer k and either a block of text, or a 2d array that the inner arrays may have unequal lengths (that resembles a block of text), rotate every character or element in the k-th column up or ...
871 views

### Calculating total slots

Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (...
230 views

### Morse sudo-ku-de

Hehe, see what I did with the title? Anyways... Your job is to create a sudoku solver that accepts input in Morse code and creates output in Morse code. Here's the Morse code numbers for reference: <...
3k views

### Print a physical multiplication table

Rectangles have this nice property - an $n \times m$ rectangle consists of exactly $n \times m$ characters! A.. more interesting property is that the rectangles can be aligned nicely in a ...
8k views

Challenge: Input: A list of distinct positive integers within the range $[1, \text{list-size}]$. Output: An integer: the amount of times the list is riffle-shuffled. For a list, this means the ...
3k views

### Deal the cards to the players

Tonight is card game night! You are the dealer and your task is to write a program to deal the cards to the players. Given an array of cards and the number of players, you need to split the array of ...
3k views

### Create chunks from an array

Your task is to write a program which given an array and a number, you need to split the array into chunks with size is number. Rules Your program will receive an array ...
802 views

### Arrays Start at $\pi$

Your task is to take an array of numbers and a real number and return the value at that point in the array. Arrays start at $\pi$ and are counted in $\pi$ intervals. Thing is, we're actually going ...