conventions.io

Tech Challenge

2026-10-04

🦫

Daily Tech Challenge

Go

medium
Question 1 of 5

What does this Go program print, given how the strings package treats an empty substring or empty character set?

Example
package main

import (
	"fmt"
	"strings"
)

func main() {
	s := "gopher"
	fmt.Println(
		strings.Contains(s, ""),
		strings.ContainsAny(s, ""),
		strings.HasPrefix(s, ""),
		strings.Index(s, ""),
	)
}

Sunday, October 4, 2026 · A new challenge drops every day