Professional Documents
Culture Documents
install_sh
user@workspaceql5fp555wx3c76a5:/projects/challenge$ bash .install_sh
user@workspaceql5fp555wx3c76a5:/projects/challenge$ cd linkedlist_java
user@workspaceql5fp555wx3c76a5:/projects/challenge/linkedlist_java$ git push origin
master Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads.Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 1.06 KiB | 1.06 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To ../.assessment/remote
* [new branch] master -> master
user@workspaceql5fp555wx3c76a5:/projects/challenge/linkedlist_java$ git checkout -b
new_branch
Switched to a new branch 'new_branch'
user@workspaceql5fp555wx3c76a5:/projects/challenge/linkedlist_java$ git status
On branch new_branch
nothing to commit, working tree clean
user@workspaceql5fp555wx3c76a5:/projects/challenge/linkedlist_java$ git status
On branch new_branch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: linked_list/LinkedList.java
no changes added to commit (use "git add" and/or "git commit -a")
user@workspaceql5fp555wx3c76a5:/projects/challenge/linkedlist_java$ git add .
user@workspaceql5fp555wx3c76a5:/projects/challenge/linkedlist_java$ git status
On branch new_branch
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: linked_list/LinkedList.java
/opt/mdp/kafka_2.11-1.0.0/bin/zookeeper-server-start.sh -daemon
config/zookeeper.properties > /dev/null
/opt/mdp/kafka_2.11-1.0.0/bin/kafka-server-start.sh -daemon
config/server.properties > /dev/null
'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
/*
* Complete the 'exam' function below.
*
* The function is expected to return an INTEGER.
* The function accepts INTEGER_ARRAY v as parameter.
*/
function exam(v) {
var a = (function (s) { var a = []; while (s-- > 0)
a.push(null); return a; })(/* size */ v.length);
a = /* toArray */ (function (a1, a2) { if (a1.length >= a2.length) {
a1.length = 0;
a1.push.apply(a1, a2);
return a1;
}
else {
return a2.slice(0);
} })(a, v);
var n = a.length;
var onesUntilIndex = (function (s) { var a = []; while (s-- > 0)
a.push(0); return a; })(n + 1);
for (var i = 1; i <= n; i++) {
{
onesUntilIndex[i] = a[i - 1] === 1 ? onesUntilIndex[i - 1] + 1 :
onesUntilIndex[i - 1];
}
;
}
var k = 0;
for (var i = 0; i <= n; i++) {
{
var your_ones = onesUntilIndex[i];
var you_zeros = i - your_ones;
var your_sum = your_ones - you_zeros;
var friend_ones = onesUntilIndex[n] - your_ones;
var friend_zeros = (n - i) - friend_ones;
var friend_sum = friend_ones - friend_zeros;
if (your_sum > friend_sum) {
k = i;
break;
}
}
;
}
return k;
function main() {