Skip to content

Instantly share code, notes, and snippets.

@fbaierl
fbaierl / NumberOfIslands.scala
Last active August 14, 2018 08:29
NumberOfIslands
/*
https://leetcode.com/problems/number-of-islands/description/
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input:
11110
11010
@fbaierl
fbaierl / FirstMissingPositive
Last active August 14, 2018 09:34
first_missing_positive
/*
https://leetcode.com/problems/first-missing-positive/description/
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
Input: [1,2,0]
Output: 3
Example 2:
Install for pantheon (elementary os):
1. sudo apt install fcitx fcitx-googlepinyin fcitx-mozc im-config
2. im-config -> select: fcitx
3. reboot
4. fcitx configure