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
def atMostNGivenDigitSet(digits: Array[String], n: Int): Int = { | |
val sorted = digits.map(_.toInt).sorted | |
val maxPow = math.log10(n).toInt | |
def atMostNGivenDigitSet(sorted: Array[Int], pow: Int = 0): collection.mutable.Set[Int] = { | |
if (pow > maxPow) return collection.mutable.Set() | |
val digitSet = collection.mutable.Set[Int]() | |
for (digit <- sorted) { |
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
def findLettersOrDigits(chars: Array[Char], i: Int, f: Char => Boolean): String = { | |
if (i == chars.length) return "" | |
val char = chars(i) | |
if (f(char)) { | |
char.toString + findLettersOrDigits(chars, i + 1, f) | |
} | |
else { | |
"" |
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
def connect(root: Node): Node = { | |
def connectEdges(left: Node, right: Node): Unit = { | |
if (left == null) return | |
println(left.value) | |
left.next = right | |
connectEdges(left.right, right.left) | |
} |
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
object Solution { | |
def flipAndInvertImage(A: Array[Array[Int]]): Array[Array[Int]] = { | |
for {row <- A} yield row.reverse.map(_^1) | |
} | |
} |
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
def maxAncestorDiff(root: TreeNode): Int = { | |
def visit(node: TreeNode, min: Int, max: Int): Int = { | |
if (node == null) return 0 | |
val diff = math.max(math.abs(node.value - max), math.abs(node.value - min)) | |
val newMin = math.min(node.value, min) | |
val newMax = math.max(node.value, max) | |
math.max(math.max(diff, visit(node.left, newMin, newMax)), visit(node.right, newMin, newMax)) | |
} |
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
### Keybase proof | |
I hereby claim: | |
* I am brunofarache on github. | |
* I am brunofarache (https://keybase.io/brunofarache) on keybase. | |
* I have a public key ASCZktYBXeojNUooIaGEjYtQ5kjKAa57RtVwsYqq-ZpxSAo | |
To claim this, I am signing this object: |
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
remote="$1" | |
url="$2" | |
folder="modules/private/apps/portal-workflow/portal-workflow-metrics-web" | |
origin="origin" | |
if [[ $remote != $origin ]]; then | |
exit 0 | |
fi | |
cd $folder |
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
os: osx | |
language: xamarin | |
solution: solution-name | |
mono: | |
mdk: 4.6.2 | |
android: 7.0.2-42 | |
ios: 10.3.1.8 | |
android: |
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
curl https://loop-uat.liferay.com/api/jsonws/loop-portlet.feed/viewMyNewFeed \ | |
-u bruno.farache@liferay.com:weloveliferay \ | |
-d assetTagNames= \ | |
-d childAssetEntrySetsLimit=1 \ | |
-d end=1 \ | |
-d likedParticipantsLimit=1 \ | |
-d modifiedTime=0 \ | |
-d parentAssetEntrySetId=0 \ | |
-d start=0 |
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
Launchpad | |
.url("http://liferay.io/todo/tasks/items") | |
.param("checked", true) | |
.param("description", "Organize DevCon 2015") | |
.param("name", "Ruth Heil") | |
.post() | |
.then { response in | |
XCTAssertTrue(response.succeeded) | |
} | |
.done() |
NewerOlder