# Halo

A magic place for coding

0%

## Problem

We are given two arrays A and B of words. Each word is a string of lowercase letters.

Now, say that word b is a subset of word a if every letter in b occurs in a, including multiplicity. For example, "wrr" is a subset of "warrior", but is not a subset of "world".

Now say a word a from A is universal if for every b in B, b is a subset of a.

Return a list of all universal words in A. You can return the words in any order.

## Problem

You are given an m x n integer matrix heights representing the height of each unit cell in a continent. The Pacific ocean touches the continent’s left and top edges, and the Atlantic ocean touches the continent’s right and bottom edges.

Water can only flow in four directions: up, down, left, and right. Water flows from a cell to an adjacent one with an equal or lower height.

Return a list of grid coordinates where water can flow to both the Pacific and Atlantic oceans.

## Problem

Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A [i] > B [i].

Return any permutation of A that maximizes its advantage with respect to B.

## Problem

Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i <j < k and arr [i] + arr [j] + arr [k] == target.

As the answer can be very large, return it modulo 109 + 7.

## Problem

Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word.

For a given query word, the spell checker handles two categories of spelling mistakes:

• Capitalization: If the query matches a word in the wordlist (

case-insensitive

), then the query word is returned with the same case as the case in the wordlist.

• Example: wordlist = ["yellow"], query ="YellOw":correct = "yellow"
• Example: wordlist = ["Yellow"], query ="yellow":correct = "Yellow"
• Example: wordlist = ["yellow"], query ="yellow":correct = "yellow"
• Vowel Errors: If after replacing the vowels

of the query word with any vowel individually, it matches a word in the wordlist (

case-insensitive

), then the query word is returned with the same case as the match in the wordlist.

• Example: wordlist = ["YellOw"], query ="yollow":correct = "YellOw"
• Example: wordlist = ["YellOw"], query ="yeellow":correct = "" (no match)
• Example: wordlist = ["YellOw"], query ="yllw":correct = "" (no match)

In addition, the spell checker operates under the following precedence rules:

• When the query exactly matches a word in the wordlist (case-sensitive), you should return the same word back.
• When the query matches a word up to capitlization, you should return the first such match in the wordlist.
• When the query matches a word up to vowel errors, you should return the first such match in the wordlist.
• If the query has no matches in the wordlist, you should return the empty string.

Given some queries, return a list of words answer, where answer [i] is the correct word for query = queries [i].

## Problem

You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero.

Return true if and only if we can do this so that the resulting number is a power of two.

## Problem

There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.

Formally, each room i has a list of keys rooms [i], and each key rooms [i][j] is an integer in [0, 1, ..., N-1] where N = rooms.length. A key rooms [i][j] = v opens the room with number v.

Initially, all the rooms start locked (except for room 0).

You can walk back and forth between rooms freely.

Return true if and only if you can enter every room.

## Problem

Given an integer array nums, return the length of the longest wiggle sequence.

A wiggle sequence is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with fewer than two elements is trivially a wiggle sequence.

• For example, [1, 7, 4, 9, 2, 5] is a wiggle sequence because the differences (6, -3, 5, -7, 3) are alternately positive and negative.
• In contrast, [1, 4, 7, 2, 5] and [1, 7, 4, 5, 5] are not wiggle sequences, the first because its first two differences are positive and the second because its last difference is zero.

A subsequence is obtained by deleting some elements (eventually, also zero) from the original sequence, leaving the remaining elements in their original order.