Skip to content

Commit

Permalink
feat: add queens attack structure
Browse files Browse the repository at this point in the history
  • Loading branch information
leometzger committed Sep 18, 2023
1 parent 9e86095 commit 4cc0fef
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
7 changes: 7 additions & 0 deletions implementation/queens_attack_ii.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package implementation

// https://www.hackerrank.com/challenges/queens-attack-2/problem?isFullScreen=false

func queensAttack(n int32, k int32, r_q int32, c_q int32, obstacles [][]int32) int32 {
return 0
}
53 changes: 53 additions & 0 deletions implementation/queens_attack_ii_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package implementation

import (
"testing"

"github.com/stretchr/testify/assert"
)

type QueensAttackIITestCase struct {
n int32
k int32
r_q int32
c_q int32
obstacles [][]int32
result int32
}

func TestQueensAttackII(t *testing.T) {
tests := []QueensAttackIITestCase{
{
n: 1,
k: 0,
r_q: 1,
c_q: 1,
result: 0,
obstacles: [][]int32{},
},
{
n: 4,
k: 0,
r_q: 4,
c_q: 4,
result: 9,
obstacles: [][]int32{},
},
{
n: 5,
k: 3,
r_q: 4,
c_q: 3,
result: 10,
obstacles: [][]int32{
{5, 5},
{4, 2},
{2, 3},
},
},
}

for _, test := range tests {
assert.Equal(t, test.result, queensAttack(test.n, test.k, test.r_q, test.c_q, test.obstacles))
}
}

0 comments on commit 4cc0fef

Please sign in to comment.