Skip to content

Instantly share code, notes, and snippets.

View GAierken's full-sized avatar
🦄
Creating.

Gulgina Arkin GAierken

🦄
Creating.
View GitHub Profile
class Person{
constructor(name){
this.name = name;
}
//class method to return the string
toString(){
return (`Name of person: ${this.name}`);
}
}
class Employee extends Person{
const Movie = function(n, d) {
// private variables
let name = n;
let director = d;
// class method
this.giveName = function() {
return name;
}
// private method
const Movie = function(n, d){
let name = n
let director = d
return {
description: function(){
console.log(`${director} directed ${name} `)
}
@GAierken
GAierken / Movie.js
Last active September 4, 2020 01:33
class Movie {
//initialize the instance of Move class with name and director
constructor(name, director){
this.name = name
this.director = director
}
}
const maxSubArray = (nums) => {
// initiate two variable, maxSum for total max, sum for current max
let maxSum = -Infinity
let currentSum = 0
// iterate through the nums, store sub-problems result
for(let i = 0; i < nums.length; i++){
//cumulating answers to the top
//compare currentSum add current number
//with current number and store the maximum value
class Node {
constructor(value){
this.value = value
this.next = null
}
}
class Queue {
constructor(){
class Node {
constructor(value){
this.value = value
this.next = null
}
}
class Queue {
constructor(){
class RecentCounter{
//initialize the class with queue property,
//which is an empty array
constructor(){
this.queue = []
}
//ping method receive integer t
//which represents some time in milliseconds
ping(t){
class Node {
constructor(value){
this.value = value
this.next = null
}
}
class Queue {
constructor(){
class Node {
constructor(value){
this.value = value
this.next = null
}
}
class Stack {