Skip to content

Instantly share code, notes, and snippets.

View ikyamelia's full-sized avatar

Rizky Amelia Yulistianingsih ikyamelia

View GitHub Profile
@ikyamelia
ikyamelia / bracketMatcher.js
Created August 12, 2021 05:06
Tech Tryout Glints - 03
function BracketMatcher(str) {
var lP = 0;
var rP = 0;
for (var i=0; i<str.length; i++) {
if(str[i] === '(') lP++;
if(str[i] === ')') rP++;
if(rP > lP) return 0;
}
if (rP === lP) return 1;
return 0;
@ikyamelia
ikyamelia / prime.js
Created August 12, 2021 05:01
Tech Tryout Glints - 03
function PrimeTime(num) {
for (let i = 2; i < num; i++) {
if (num % i === 0) {
return false
}
}
return true;
}
@ikyamelia
ikyamelia / countingminutes.js
Created August 12, 2021 04:57
Tech Tryout Glints - 03
function CountingMinutesI(str) {
var time10bj = {}, time20bj = {}, timeDiff;
time10bj = setTimeObject(str, 0);
time20bj = setTimeObject(str, 1);
if (time10bj.ampm == time20bj.ampm && time10bj.tot > time20bj.tot) {
timeDiff = (((12 - time10bj.hours + 12) * 60) - (time10bj.mins)) + ((time20bj.hours * 60) + time20bj.mins);
}
@ikyamelia
ikyamelia / abcheck.js
Created August 12, 2021 04:38
Tech Tryout Glints-03
function ABCheck(str) {
var arr = str.toLowerCase().split("").join("").replace( /\s/g, "")
for(var i = 0; i < arr.length; i++) {
if(arr[i].indexOf('a') != -1 && arr[i+3].indexOf('b') != -1) {
return true
}
}
return str;
}
@ikyamelia
ikyamelia / assessmentglints-reacttitactactoe.js
Created July 30, 2021 03:04
Assessment Glints React Tic Tac Toe
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const rowStyle = {
display: 'flex'
}
const squareStyle = {
'width':'60px',
'height':'60px',
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const style = {
table: {
borderCollapse: 'collapse'
},
tableCell: {
border: '1px solid gray',
margin: 0,