Skip to content

Commit 15ca9bc

Browse files
authored
Merge branch 'main' into longest-dictionary-word-fix
2 parents 3a11669 + bb95855 commit 15ca9bc

8 files changed

+23
-13
lines changed

bit/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ Left shifting can be viewed as a multiplication operation by 2 raised to the pow
5050
```Go
5151
package main
5252

53-
import (
54-
"fmt"
55-
)
53+
import "fmt"
5654

5755
func main() {
5856
fmt.Println(1 << 5) // Prints 32. 1 * 2^5 = 32

bit/addition_without_operators_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ TestAdditionWithoutArithmeticOperators tests solution(s) with the following sign
77
88
func Add(x, y int) int
99
10-
Add x by y, two integers without using any arithmetic operators such as {+,-,/,*,++,--,+=,…}.
10+
Given two integers add them without using any arithmetic operators such as {+,-,/,*,++,--,+=,…}.
11+
12+
For example given 2 and 3 return 5.
1113
*/
1214
func TestAdditionWithoutArithmeticOperators(t *testing.T) {
1315
tests := []struct {

bit/division_without_operators_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ TestDivision tests solution(s) with the following signature and problem descript
77
88
func Divide(x, y int) int
99
10-
Divide x by y, two integers without using the built-in `/` or `*` operators.
10+
Given two integers, divide them without using the built-in `/` or `*` operators.
11+
12+
For example given 20 and 4 return 5.
1113
*/
1214
func TestDivision(t *testing.T) {
1315
tests := []struct {

bit/is_power_of_two_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ TestIsPowerOfTwo tests solution(s) with the following signature and problem desc
77
88
func IsPowerOfTwo(input int) bool
99
10-
Using bit manipulation, return true if a given number like 2 and false otherwise.
10+
Using bit manipulation, return true if a given number is a power of 2 and false otherwise.
11+
12+
For example given 20 return false. Given 256 return true because 2 ^ 8 = 256.
1113
*/
1214
func TestIsPowerOfTwo(t *testing.T) {
1315
tests := []struct {

bit/max_without_comparison_operators_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ TestMax tests solution(s) with the following signature and problem description:
77
88
func Max(x, y int) int
99
10-
Write max, a function that returns the largest of two numbers without using a
11-
any of the comparison operators such as {if, switch,…}.
10+
Given two integers, return the larger of the two without using any comparison
11+
operations like {if, switch,…}.
12+
13+
For example given 20 and 2 return 20.
1214
*/
1315
func TestMax(t *testing.T) {
1416
tests := []struct {

bit/middle_without_division_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ TestMiddleWithoutDivision tests solution(s) with the following signature and pro
77
88
func MiddleWithoutDivision(min, max int)
99
10-
Given two integers min and max like `1` and `5`, return an integer like `3` that is in
11-
the middle of the two.
10+
Given two integers return the integer that is in the middle of the two integers without
11+
using any arithmetic operators such as {+,-,/,*,++,--,+=,…}.
12+
13+
For example given 1 and 5, return 3. This is because 3 is in the middle of integers 1 to 5.
1214
*/
1315
func TestMiddleWithoutDivision(t *testing.T) {
1416
tests := []struct {

bit/oddly_repeated_number_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ TestOddlyRepeatedNumber tests solution(s) with the following signature and probl
77
88
func OddlyRepeatedNumber(list []int) int
99
10-
Given an array of integers that are all repeated an even number of times except one,
10+
Given a slice of integers that are all repeated an even number of times except one,
1111
find the oddly repeated element.
12+
13+
For example given {1, 2, 2, 3, 3} return 1. Given {1, 2, 1, 2, 3} return 3.
1214
*/
1315
func TestOddlyRepeatedNumber(t *testing.T) {
1416
tests := []struct {

graph/employee_headcount_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ TestEmployeeHeadCount tests solution(s) with the following signature and problem
99
1010
Headcount of a person in an organization is 1 + the number of all their reports
1111
(direct and indirect). Given a list of employee IDs and their direct reports in each line like
12-
`1,4,5`, `5,7`, `4`, `7`. Where 1 has two direct reports (4 and 5); 5 has one report (7);
13-
4 and 5 have no reports; Return the headcount of a given employee ID. For example head
12+
`1,4,5`, `5,7`, `4`, `7`. Where 1 has two direct reports (4 and 5) and one indirect report (7); 5 has one report (7);
13+
4 and 7 have no reports; Return the headcount of a given employee ID. For example head
1414
count of 7 is 1, and headcount of 1 is 4.
1515
*/
1616
func TestEmployeeHeadCount(t *testing.T) {

0 commit comments

Comments
 (0)