Skip to content

Commit 925a87e

Browse files
authored
fixed formatting 1882-process-tasks-using-servers.js
1 parent 37b622f commit 925a87e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

javascript/1882-process-tasks-using-servers.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
var assignTasks = function(servers, tasks) {
1010

1111
const toBeCompleted = new MinPriorityQueue({
12-
compare: (a,b) => {
13-
if(a[0] === b[0]) return a[1] - b[1];
12+
compare: (a, b) => {
13+
if (a[0] === b[0]) return a[1] - b[1];
1414
return a[0] - b[0];
1515
}
1616
});
1717

1818
const freeServers = new MinPriorityQueue({
19-
compare: (a,b) => {
20-
if(a[0] === b[0]) return a[1] - b[1];
19+
compare: (a, b) => {
20+
if (a[0] === b[0]) return a[1] - b[1];
2121
return a[0] - b[0];
2222
}
2323
});
2424

25-
for(let i = 0; i < servers.length; i++) {
25+
for (let i = 0; i < servers.length; i++) {
2626
const weight = servers[i];
2727
const idx = i;
2828
freeServers.enqueue([weight, idx]);
@@ -31,17 +31,16 @@ var assignTasks = function(servers, tasks) {
3131
let sec = 0;
3232
const result = [];
3333

34-
for(let i = 0; i < tasks.length; i++) {
34+
for (let i = 0; i < tasks.length; i++) {
3535
sec = Math.max(i, sec);
3636

3737
// if the we don't have server available then jump to the next imidiate
3838
// time when the server will be available.
39-
if(freeServers.isEmpty()) {
39+
if (freeServers.isEmpty()) {
4040
sec = toBeCompleted.front()[0];
4141
}
42-
while(!toBeCompleted.isEmpty() &&
43-
toBeCompleted.front()[0] <= sec
44-
) {
42+
while (!toBeCompleted.isEmpty() &&
43+
toBeCompleted.front()[0] <= sec) {
4544
const [endTime, serverIdx] = toBeCompleted.dequeue();
4645
const weight = servers[serverIdx];
4746
freeServers.enqueue([weight, serverIdx]);

0 commit comments

Comments
 (0)