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
<?php | |
// average value of array | |
// anda memiliki sebuah array 'arr' yang berisi : [1, 5, 6] | |
// buatlah program untuk menentukan nilai rata rata dari item di dalam array tersebut | |
// arr = [1, 5, 6], maka rata rata nya adalah 4, karena (1 + 5 + 6) / 3 = 4 | |
$arr1 = [2, 2, 50]; | |
$result1 = 0; // 18 |
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
// please make this code more clean, and remember dont repeat your self (DRY) | |
class Book { | |
final String? table; | |
Book({this.table}); | |
void create() { | |
print('Insert to table : ${table}'); |
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
// complete this code, so whenever i call the class, the return value must be exactly same | |
// clue : https://refactoring.guru/design-patterns/singleton | |
import 'dart:math'; | |
class InMemory { | |
String _value = ''; | |
String get value => _value; |
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
// Complete this function, that will implementing simple load balancer logic | |
var rules = { | |
"I": 1, | |
"V": 5, | |
"X": 10, | |
"L": 50, | |
}; | |
int romanToInteger(String payload) { |
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
// Complete this function, that will implementing simple load balancer logic | |
int counter = 0; | |
String next(List<String> payload) { | |
return ""; | |
} | |
main() { | |
List<String> servers = ["192.168.1.2", "192.168.1.3", "192.168.1.4"]; |
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
// Complete this function, that determine is given number can be | |
// square rooted or not | |
// example : | |
// payload : 4 | |
// the result is true, because 4 is 2 to the power of 2 | |
bool isRootNumber(int payload) { | |
return false; | |
} |
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
// Complete this function, that determine is given number can be | |
// Complete this function, that count how much unique value in an array | |
// example : | |
// payload : ["a", "a", "b", "c", "a"] | |
// the result is 3, beccause there is just 3 unique value in array | |
// clue : https://www.darttutorial.org/dart-tutorial/dart-set/ | |
int countUnique(List<String> payload) { |
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
// Complete this function, that determine is given number can be | |
// square rooted or not | |
// example : | |
// payload : 4 | |
// the result is true, because 4 is 2 to the power of 2 | |
// Complete this function, that will add up two item of a 'payload' | |
// that equal to '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
class ActivityTaskSigner { | |
final int userId; | |
final int order; | |
final String status; | |
ActivityTaskSigner( | |
{required this.userId, required this.order, required this.status}); | |
} | |
bool isApproveDisable(int userId, List<ActivityTaskSigner> signers) { |
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
class ActivityTaskSigner { | |
final int userId; | |
final int order; | |
final String status; | |
ActivityTaskSigner({required this.userId, required this.order, required this.status}); | |
} | |
bool isApproveDisable(int userId, List<ActivityTaskSigner> signers) { | |
return signers.asMap().entries.any((entry) { |