Coding Problem: First Non-Repeating Character in Go. Writing coding problems in with my most relevant language to stay sharp on my programming. The First Non-Repeating Character problem is defined by an input of a single string of English characters.
Sharpen your coding skills!
This article is part of my personal habit of writing coding problems in with my most relevant language to stay sharp on my programming and problem solving skills. The First Non-Repeating Character question is a well-known beginner computer science question. Here we will understand the problem, write table-driven tests and develop two solutions using Go.
Let’s code!
While the title is fairly self-descriptive, it’s always best to understand a coding problem by first walking through some examples. In our case, the First Non-Repeating Character problem is defined by an input of a single string of English characters and an output of the index of the string’s first non-repeating character. If there are no non-repeating characters, then the function should return -1
.
Here are a few examples:
----- Example 1 -----
Input: abbcddeff
Output: 0
----- Example 2 -----
Input: abbNadNe
Output: 4
----- Example 3 -----
Input: ddd
Output: -1
You should always try working out these examples yourself, especially in a coding interview, to gain an initial grasp of the problem. This question can be understood with just a few examples, so now let’s move onto the tests.
Python Programming Tutorials For Beginners
An introduction to the go programming language for beginners. In this golang tutorial you will learn the basics of go, setup a go lang coding environment and...
Golang Web Development is the new trend globally. Get all the details about the Golang development here. Hire Golang Developers.
Golang array is a fixed-size collection of items of the same type. The items of an array are stored sequentially and can be accessed using their index.
Find out exactly how to create a Golang video streaming server using HLS with this easy tutorial! Format your media and build a server, step-by-step.