Practice Go. Coins @ Alex Pliutau's Blog
Coins
Let Piles(n int)
represent the number of different ways in which n
coins can be separated into piles. For example, five coins can be separated into piles in exactly seven different ways, so Piles(5)=7
.
OOOOO
OOOO O
OOO OO
OOO O O
OO OO O
OO O O O
O O O O O
Input
0 < n <= 1000000
Run tests with benchmarks
go test -bench .
相關推薦
Practice Go. Coins @ Alex Pliutau's Blog
Coins Let Piles(n int) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be
Practice Go: Warriors @ Alex Pliutau's Blog
BitVille and ByteVille are 2 warring tribes. BitVille has a spy telescope called the Hobble Scope, to count the number of Byte Warriors in B
Practice Go: Secret Message @ Alex Pliutau's Blog
I just created a new challenge in Practice Go collection, happy to review all possible solutions and choose the best one. Secret Message Cre
Practice Go: Mosaic Photo @ Alex Pliutau's Blog
Your mission is to write a mosaic-photo generating command line program that: Allows the user to select a target picture. Allows the user
Practice Go: Roman Numerals @ Alex Pliutau's Blog
Create 2 functions: Encode(n int) (string, bool) - takes an integer as its parameter and returns a string containing the Roman numeral rep
Practice Go: Web Scraping @ Alex Pliutau's Blog
Web Scraping Create a function that finds the time from this http://tycho.usno.navy.mil/cgi-bin/timer.pl and then prints it by extracting t
Practice Go: Missing Numbers @ Alex Pliutau's Blog
Given an array containing all the numbers from 1 to n except two, find the two missing numbers. Example missing([]int{4, 2, 3}) = []int{1
Practice Go: Function Frequency @ Alex Pliutau's Blog
Function Frequency Given a valid Go code in gocode.txt file find top-3 used functions. Don’t count function declaration. This is a static a
Practice Go. Find Broken Node @ Alex Pliutau's Blog
We have a chain of nodes, the functionality of each node is to find if next node is working well. Unfortunately, we recently found that some
Practice Go: Print Spiral @ Alex Pliutau's Blog
Write a program that will display a spiral of n × n numbers. Make sure your program uses constant (or linear) space. This means, it is not a
Practice Go: First Letter, Last Letter game @ Alex Pliutau's Blog
First Letter, Last Letter game There is a game I played a lot in school. The game is called first letter, last letter. The object of this
Practice Go: Reverse Parentheses @ Alex Pliutau's Blog
Reverse Parentheses Complete the function that reverses characters in (possibly nested) parentheses in the input string. Input strings will
Practice Go. Short Hash @ Alex Pliutau's Blog
This function can be used to generate short unique hashes, for example in URL shorteners. You’re given a dictionary of unique characters and
Practice Go. Build Word @ Alex Pliutau's Blog
Seems like previous exercise is a quite difficult to implement :) Here is a new one. Build Word You have a word in lowercase. Your task is t
packagemain: Youtube channel about Programming in Go @ Alex Pliutau's Blog
I’m really enjoying to share some stuff about Golang and related technologies. I am blogging here and also on dev.to. But I want to try the n
Coming soon: Microservices with Go Workshop, Vietnam, HCMC @ Alex Pliutau's Blog
One month ago Wizline organized the Microservices with Go Workshop in Mexico, GDL as part of Wizeline Academy I am happy to announce that we’re
Go tools are awesome @ Alex Pliutau's Blog
Yes, they are. And that’s why I love Go. Almost all important tools come together with Go installation, but there are also some you can inst
How to build Go plugin with data inside @ Alex Pliutau's Blog
Go 1.8 gives us a new tool for creating shared libraries, called plugins! This new plugin buildmode is currently only supported on Linux. But
Getting Started with OAuth2 in Go @ Alex Pliutau's Blog
Getting started with OAuth2 in Go Authentication usually is very important part in any application. You can always implement your own aut
Building Google Home Action in Go @ Alex Pliutau's Blog
Google Home Google Home is a voice Assistant, similar to Amazon Alexa, but working with Google services. It has a lot of built-in integra