Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 4672cea

Browse files
committed
1081 wrong answer
1 parent bdb35ee commit 4672cea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Algorithms/1081.smallest-subsequence-of-distinct-characters/smallest-subsequence-of-distinct-characters.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@ type letter struct {
4141
}
4242

4343
func isLess(a, b *letter) bool {
44-
return a.char < b.char && a.indexs[0] < b.indexs[len(b.indexs)-1]
44+
if a.indexs[0] < b.indexs[len(b.indexs)-1] &&
45+
b.indexs[0] < a.indexs[len(a.indexs)-1] {
46+
return a.char < b.char
47+
}
48+
return false
4549
}

0 commit comments

Comments
 (0)