This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"strings" | |
) | |
const input = `Hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// Swapping with Assignment | |
i := 1 | |
j := 2 | |
i, j = j, i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
var i int | |
var i8 int8 | |
var i16 int16 | |
var i32 int32 | |
var i64 int64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
import ( | |
"testing" | |
) | |
var testcases = [...]struct { | |
n []int | |
emaxSum int | |
emi int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
func mspN3(n []int) (maxSum, mi, mj int) { | |
l := len(n) | |
if l == 0 { | |
return -1, -1, -1 | |
} | |
maxSum = n[0] | |
for i := 0; i < l; i++ { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
func mspN2(n []int) (maxSum, mi, mj int) { | |
l := len(n) | |
if l == 0 { | |
return -1, -1, -1 | |
} | |
maxSum = n[0] | |
for i := 0; i < l; i++ { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
func mspN1(n []int) (maxSum, mi, mj int) { | |
l := len(n) | |
if l == 0 { | |
return -1, -1, -1 | |
} | |
maxSum = n[0] | |
sum := n[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
import ( | |
"testing" | |
) | |
var testcases = [...]struct { | |
n []int | |
emaxSum int | |
emi int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
func mspN3(n []int) (maxSum, mi, mj int) { | |
l := len(n) | |
if l == 0 { | |
return -1, -1, -1 | |
} | |
maxSum = n[0] | |
for i := 0; i < l; i++ { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package msp | |
func mspN2(n []int) (maxSum, mi, mj int) { | |
l := len(n) | |
if l == 0 { | |
return -1, -1, -1 | |
} | |
maxSum = n[0] | |
for i := 0; i < l; i++ { |
NewerOlder