removed 1 map
This commit is contained in:
		@@ -5,21 +5,20 @@ func longestConsecutive(nums []int) (max int) {
 | 
				
			|||||||
	for _, n := range nums {
 | 
						for _, n := range nums {
 | 
				
			||||||
		exists[n] = true
 | 
							exists[n] = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	done := make(map[int]bool, len(nums))
 | 
					 | 
				
			||||||
	for _, n := range nums {
 | 
						for _, n := range nums {
 | 
				
			||||||
		if _, ok := done[n]; !ok {
 | 
							if _, ok := exists[n]; ok {
 | 
				
			||||||
			done[n] = true
 | 
								exists[n] = false
 | 
				
			||||||
			l := 1
 | 
								l := 1
 | 
				
			||||||
			for exists[n+1] {
 | 
								for exists[n+1] {
 | 
				
			||||||
				l++
 | 
									l++
 | 
				
			||||||
				n++
 | 
									n++
 | 
				
			||||||
				done[n] = true
 | 
									exists[n] = false
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			n -= l - 1
 | 
								n -= l - 1
 | 
				
			||||||
			for exists[n-1] {
 | 
								for exists[n-1] {
 | 
				
			||||||
				l++
 | 
									l++
 | 
				
			||||||
				n--
 | 
									n--
 | 
				
			||||||
				done[n] = true
 | 
									exists[n] = false
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if l > max {
 | 
								if l > max {
 | 
				
			||||||
				max = l
 | 
									max = l
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user