This file contains hidden or 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
const stringOne = "abccbad"; ===> Expected Output: "d"; | |
const stringTwo = "abccba"; ===> Expected Output: null; | |
const stringThree = "xcsix"; ===> Expected Output: "c"; | |
This file contains hidden or 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
// School Management System is a software application designed to manage students, teachers, and academic activities within a school. | |
// It streamlines operations such as enrollment, grading, and communication between staff and students. | |
// 1- | |
class School { | |
private students: string[] = []; | |
private teachers: string[] = []; | |
addStudent(name: string): void { | |
this.students.push(name); |
This file contains hidden or 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
setTimeout(function () { | |
console.log("A"); | |
}, 1000); | |
setTimeout(function () { | |
console.log("B"); | |
}, 0); | |
console.log("C"); |
This file contains hidden or 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
const arr = [[2, 3, [4]], 10, [5], [9, 7]]; | |
// flatten logic. | |
console.log(arr); // [2, 3, 4, 10, 5, 9, 7] |
This file contains hidden or 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
/** | |
* Generates the string for the Haversine function. We assume that the `zipcode`, `latitude`, | |
* and `longitude` columns are named accordingly. We are also not doing much error-checking | |
* here; this is a simple text cruncher to make things prettier. | |
* We may also be integrating some extra SQL in, passed in via the $extra parameter | |
* | |
* @param string $table The table to search in | |
* @param float $lat The latitude part of the reference coordinates | |
* @param float $lng The longitude part of the reference coordinates | |
* @param int $radius The radius to search within |
This file contains hidden or 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
/* | |
* Codingame Power of thor Level Solution. | |
* | |
* | |
*/ | |
var inputs = readline().split(' '); | |
var lightX = parseInt(inputs[0]); // the X position of the light of power | |
var lightY = parseInt(inputs[1]); // the Y position of the light of power | |
var x = parseInt(inputs[2]); // Thor's starting X position | |
var y = parseInt(inputs[3]); // Thor's starting Y position |
This file contains hidden or 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
using System; | |
namespace Adder | |
{ | |
public class Adder | |
{ | |
public int Add(int x, int y) | |
{ | |
return x + y; | |
} |
This file contains hidden or 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 | |
function factorial($number) { | |
if($number <= 1) return 1; | |
return $number*factorial($number-1); | |
} |
This file contains hidden or 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 Person(name) { | |
this.name = name; | |
} | |
Person.prototype.greet = function (otherName) { | |
return "Hi, " + otherName + " my name is: " + this.name; | |
} | |
var ahmed = new Person("Ahmed"); | |
alert(ahmed.greet("Mohamed")); // outputs "Hi!, Mohammed my name is Ahmed" |