There are N buckets arranged in a row. Each bucket either is empty or contains a ball. The buckets are specified as a string buckets consisting of characters "." (empty bucket) and " B " (bucket with aball). For example, for buckets = "B. BB. B. . B" the row of buckets appears as follows: In one move you can take the ball out of any bucket and place it in another (empty) bucket. Your goal is to arrange the balls to create an alternating sequence of full and empty buckets. In other words, the distance between two consecutive balls should be equal to 2. Note that the sequence may start at any bucket. For example, in the figure below, the balls are placed correctly: On the other hand, in both of the figures below, the balls are placed incorrectly: What is the minimum number of moves required to create a correct sequence of balls in buckets
This file contains 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
import java.util.Date | |
import akka.actor._ | |
import scala.concurrent.duration._ | |
class TimedActor extends Actor with ActorLogging { | |
override def receive: Receive = onTimer(None, None) | |
def onTimer(msgReceived: Option[Date], oldTimer: Option[Cancellable]): Receive = { | |
case msg => | |
oldTimer foreach (_.cancel()) |
This file contains 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
function untar_into() { | |
[[ -z "$1" ]] && echo "No tar file specified" && return | |
[[ -z "$2" ]] && echo "No destination specified" && return | |
[[ ! -e "$1" ]] && echo "Specified tar file absent: $1" && return | |
[[ -e "$2" ]] && echo "Destination dir already exists: $2" && return | |
local archive=$1 | |
local target=$2 | |
mkdir -pv $target | |
mv $archive $target |
This file contains 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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "alt+j", | |
"command": "editor.action.triggerSuggest", | |
"when": "editorHasCompletionItemProvider && editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "ctrl+space", | |
"command": "-editor.action.triggerSuggest", |
This file contains 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
// https://repl.it/@fswerneck/goroutines | |
package main | |
import "fmt" | |
func consume(q <-chan interface{}, finish chan<- bool) { | |
fmt.Println("getting from q") | |
mydata := <-q | |
fmt.Printf("got %v from q\n", mydata) |
Regra de linguística geral:
- Advérbios modificam tudo, até mesmo outros advérbios, com exceção de substantivos
- Apenas adjetivos modificam substantivos, e modificam apenas substantivos
Isso se aplica em qualquer idioma.
A maioria dos advérbios são, por si só, criados a partir de adjetivos.
This file contains 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
/** | |
* 2018-04-25 | |
* WaniKani Reorder - wkreorder | |
* Reorder your review items on the fly | |
* (Optimized for phones) | |
* | |
* With wk-reorder, you're able to - tada - reorder your review items by some criteria. | |
* As of this script, you're able to reorder them by SRS level, and type. | |
* The script works by getting your current queue, and applying a sort function to make it | |
* show items in the order you want them to - either ascendingly or descendingly. |
This file contains 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
/** | |
* wkrollback - WaniKani Rollback Answer | |
* Inspired by Wanikani Override userscript on Greasy Fork, | |
* but aimed at mobiles, as an inline JavaScript bookmarklet. | |
* This is the unminified code; use the minified version on | |
* your browser. | |
* | |
* Author: Fabricio da Silva Werneck | |
* Date: 2018-04-01 19:24 -0300 | |
* |
NewerOlder