Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [search]

Challenges involving searching through some data to find a certain element or elements.

12
votes
13answers
425 views

Count the contiguous submatrices

Migrated from chat Given two non-empty non-negative integer matrices A and B, answer the number of times A occurs as a contiguous, possibly overlapping, submatrix in B. Examples/Rules 0. There may ...
16
votes
30answers
1k views

Search text for a prefix and list all its suffixes in the text

I use "suffix" loosely here to mean "any sub-string that follows the prefix". "Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first ...
19
votes
28answers
2k views

Finding your partner

Challenge Given an arbitrary list of 2-tuples, and a single element in one of those tuples, output its "partner", i.e. given a and ...
6
votes
3answers
162 views

Who was the biggest “Weekend Update” host during that time period?

These are the hosts of the "Weekend Update" news segment on Saturday Night Live, with the years they hosted and their initials: ...
26
votes
15answers
2k views

The Spain license plates game

This question is based on a question I asked in Spanish language. Yes, I asked for an algorithm in Spanish Language. :) In Spain, current license plates have this pattern: 1234 XYZ where XYZ are ...
21
votes
20answers
1k views

My [sub] strings are hiding!

Introduction A while ago a lost SO user posted a question here and its now been deleted but I think it would make a good challenge so here it goes... Challenge Write a full program or function that ...
16
votes
1answer
817 views

The code-golfer way of searching a library

Challenge: I have thousands of songs in my music collection, and luckily for me, my favorite player has a search function. I also have a great memory—I can remember the title of every song in my ...
9
votes
1answer
370 views

Tiling the unit square

Background By expanding and cancelling terms, it is easy to show the following identity: However, it is an open problem whether all 1/n-by-1/(n+1) rectangles can tile the unit square. The Task ...
-5
votes
1answer
166 views

Google search result short summary [closed]

Intro When you search in google, it always shows you a result with a sample text from the found webpage. For example if you search for "Madonna greatest vinyl", google will show you one line link, ...
2
votes
0answers
97 views

All-pairs shortest return paths without reusing edges [closed]

All-pairs shortest paths is a standard pathfinding problem. This is a twist on that. Definitions We are searching for paths on a directed graph. Graphs are defined by square matrices, for example <...
12
votes
1answer
888 views

I want to watch you die of thirst

You are a traveller crossing the desert between two towns. You cannot carry enough water to get across without stopping. This is a variation of a classic puzzle. The Rules A desert looks like this: ...
26
votes
14answers
1k views

Automate the OEIS

We see a lot of challenges here asking for a function to create a sequence from the OEIS. While these challenges are fun, as a programmer I see an opportunity for automation. Your challenge is to ...
6
votes
4answers
300 views

Semi-decide Post's Correspondence Problem

The Post's Correspondence Problem (PCP) gives you a list of pairs of strings, P_1 ... P_n. Your task is to find a k, and some sequence of k indices such that fst(P_i1) ... fst(P_ik) = snd(P_i1) ... ...
17
votes
20answers
934 views

Reverse odd runs

Inspiration. Task Reverse runs of odd numbers in a given list of 2 to 215 non-negative integers. Examples 0 1 → 0 1...
20
votes
5answers
659 views

Shortest simple regex matching a binary word

Task Define a simple regex as a non-empty regular expression consisting only of characters 0 and 1, grouping parentheses ...
-2
votes
1answer
325 views

Implement branchless binary search

Challenge Implement binary search on a list of length 256 with no branches. Specification Input an integer X and a strictly increasing list of integers Output is ...
5
votes
5answers
429 views

Find that zipcode!

Italian zipcodes are 5-digit numbers. Each number is linked to a province. There are 4610 zipcodes and 110 provinces (as of 2015) in Italy. Given the list of zipcodes and the related province (in ...
4
votes
7answers
567 views

Iterative binary search

Binary search is an algorithm that looks for an element in a sorted data-structure by constantly dividing the search space in half. Rosetta Code A binary search divides a range of values into ...
8
votes
1answer
281 views

Restaurant Shorthand

Goal Sometimes dinner menus can have long winded names. It's much easier for the waiter to write an abbreviation that unambiguously identifies the dish. For example, given this list: ...
2
votes
5answers
833 views

Find X in a partially sorted Array

Your job is to find the location (read index) of a given element X in an array gone through the following transformation process: Take a fully sorted integer array ...
7
votes
4answers
3k views

Un-hash the Java Hash

Hash Un-hashing The basic goal of this challenge is to exploit the high probability of collision in the Java Hash function to create a list of plausible inputs that created an outputted hash. The ...
1
vote
0answers
202 views

Proving the shortest quine in a particular language [duplicate]

Possible Duplicate: Golf you a quine for great good! People have proposed short quines in various languages. Puzzle: Find the shortest non-trivial quine in a language of your choice, and prove ...
6
votes
3answers
575 views

Word guessing game

A program should take an input on stdin, and guess what a word might be. It should run as a session. One example session is shown below. Characters are fed to it, with a * for a letter not revealed; ...