Inspired by this problem...
Connect Four is a fun two-player game in which the goal is to be the first player to connect four pieces in a row - horizontally, vertically, or diagonally. Players take turns dropping one of their pieces into any of the available columns.
Problem Statement
Given an array (size is arbitrary) in which
return the column that player 1 should play in to win the game. If there is more than one winning move, return a row vector of appropriate columns. If there are currently no winning moves, return [].
Assumptions
Example
If
b = [0 0 0 0 0 0 0; 0 0 0 0 0 0 0; 0 0 0 2 0 0 0; 0 0 0 1 0 0 0; 0 0 0 2 2 0 0; 0 0 2 1 1 1 0];
then
y = 7
Given two strings, find the maximum overlap
300 Solvers
465 Solvers
614 Solvers
72 Solvers
103 Solvers
Solution 276412
Very creative usage of blkdiag in collaboration with conv2. I prefer nnz over "any" for speed and compactness.