Skip to content

Instantly share code, notes, and snippets.

View kenneropia's full-sized avatar
🍎
Currently building portfolio projects

Aaron Adetunmbi kenneropia

🍎
Currently building portfolio projects
View GitHub Profile
function isMonotonic(arr: Number[]): Boolean {
let monoLeft = true;
let monoRight = true;
// loop thru the arr and check for the side by side items that makes the array non-monotonic
for (let i = 0; i < arr.length - 1; i++) {
// To check if
// array is not increasing
if (arr[i] > arr[i + 1]) {
monoLeft = false;
const mergeWord = (word1: string, word2: string) => {
let shorterWord = ''
let longerWord = ''
let accu = ''
if (word1.length < word2.length) {
shorterWord = word1
longerWord = word2
} else if (word2.length < word1.length) {
shorterWord = word2
longerWord = word1
@kenneropia
kenneropia / code.ts
Last active December 30, 2023 21:50
high-level design for a time travel information retrieval system
// Define core services
class TimeTravelService {
constructor(
private timelineAnalyzer: TimelineAnalyzer,
private dataVault: DataVault,
private encryptionService: EncryptionService,
private transporter: Transporter,
private auditor: Auditor
) {}