Shermans's Notes
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Lonely Integer - XOR Integer Pairs

Lonely Integer - XOR Integer Pairs From Hacker Rank, Lonely Integer Challange Taking an array of integers, where it a guarenteed that the size is odd, and all enteries bar one is a pair, return the integer that only appears once. I knew there must be a trick to this however I didn’t figure it out. I implemented a basic solution using a map to count instances which was obviously O(N) in time.
Read full post gdoc_arrow_right_alt

Testing in Golang

Table Driven Tests Asserting with Testify Testing Suites Testing Env Vars Update Testing flag Table Driven Tests Table-driven tests format your tests to ensure that you are as DRY as possible while making it easy to add more test cases. There are plenty of resources about this, which I will link below; however, here is my appreciation. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 package testing import ( "github.
Read full post gdoc_arrow_right_alt