Skip to main content

Questions tagged [permutations]

A permutation is a particular ordering of some list of objects. Problems tagged with permutation usually involve finding or generating permutations, including anagrams of text.

11 votes
7 answers
604 views

This was originally a question from interviewstreet.com over a decade ago You are given an array (or whatever - your choice of input) of positive integers \$y_1,\ldots,y_n\$ that represents \$n\$ line ...
Henry's user avatar
  • 219
23 votes
15 answers
3k views

Your task is to write two programs/functions, in the same language. Program 1: Verify that two inputs are anagrams of each other. Program 2: Verify that two inputs differ from each other at every ...
Steve Bennett's user avatar
12 votes
9 answers
1k views

Given a permutation of {1,2,...,n} named A, do each swap of form swap A[i], A[j] exactly once, where ...
l4m2's user avatar
  • 32.5k
13 votes
13 answers
2k views

The easiest way to understand this task is to look at this graph, which you can change interactively. It defines a sequence n -> a(n) like this: a(0) = 0; thereafter a(n) is the least integer (in ...
Sophia Antipolis's user avatar
6 votes
3 answers
648 views

Each of a regular dodecahedron's 12 faces can be painted either red or blue. Your task is to implement a function \$f\$ that takes a painted dodecahedron (as 12 booleans, in whatever order and format ...
Karl's user avatar
  • 871
3 votes
4 answers
609 views

There are 251610 6 by 6 binary matrices that are inequivalent. We say two matrices are equivalent if there is some permutation of their rows and/or columns that makes them equal. For example: ...
Simd's user avatar
  • 3,167
13 votes
8 answers
1k views

The challenge is simple: Reorder the first integers {0, 1, 2, ..., n} into an ordered list so that the following three conditions are met: If k is the last element in the list, then all of its prime ...
Carl's user avatar
  • 251
8 votes
8 answers
1k views

Select any word from https://websites.umich.edu/~jlawler/wordlist with length greater than 1. For each letter on that word, remove it and check if any rearrangement of the remaining letters is present ...
enzo's user avatar
  • 2,153

15 30 50 per page
1
2 3 4 5
15