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
.alert { | |
position: relative; | |
top: 10px; | |
left: 50%; | |
translate: -50%; | |
background-color: aquamarine; | |
color: black; | |
border-radius: 5px; | |
padding: 10px; | |
cursor: pointer; |
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
/** | |
* This way, configuring a Higher-Order Component is essentially just the addition of another wrapping function around it. | |
* We accept custom messages for loading, no data or empty from the Wrapped Component | |
* OR, we provide default/generic fallback states if wrapped component doesn't provide them. | |
* @param {*} dataEmptyFeedback | |
* @param {*} noDataFeedback | |
* @param {*} dataEmptyFeedback | |
* @returns | |
*/ | |
const withConditionalFeedback = |
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
/** | |
* Write a function called sameFrequency. Given two positive integers, find out if the two numbers have the same frequency of digits. | |
The solution MUST have the following complexities: | |
Time: O(N) | |
Sample Input: | |
sameFrequency(182,281) // true |
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
/** | |
* Write a function which accepts an array of integers | |
* and a number called n. | |
* | |
* The function should calculate the maximum sum of n consecutive | |
* elements in the array. | |
*/ | |
const maxSubArraySum = (arr, n) => { | |
if (!arr.length) return null; |
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
/** | |
* Count Unique Values Problem solved 3 ways | |
* | |
* Prompt: Implement a function which accepts a sorted array and counts | |
* the unique values in the array. | |
* | |
* Negative numbers are allowed and will only be numbers. | |
* The array is always sorted* | |
* | |
* @param {*} sortedArr |
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
const validAnagram = (str1, str2) => { | |
// convert to lowercase and remove spaces | |
str1 = str1.replace(/\s+/g, "").toLowerCase(); | |
str2 = str2.replace(/\s+/g, "").toLowerCase(); | |
// Check for length once whitespace is removed | |
if (str1.length !== str2.length) return false; | |
// Only nums and lowercase letters allowed | |
const regex = /^[\w.-]+$/; |
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
/* Simple b/c it doesn't account for spaces, special chars etc...*/ | |
const validAnagram = (str1, str2) => { | |
// Immediately return if strings are diff length | |
if (str1.length !== str2.length) return false; | |
// Create "bank" for letters to live in | |
let chars = {}; | |
// Loop over first string and add letters to chars |
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
/** | |
Takes in the expirationDate param as: "3/2025" or "03/2025" etc... | |
Rookie Implementation | |
**/ | |
export default function isCreditCardExpired(expirtationDate) { | |
const now = new Date(); | |
const currentMonth = now.getMonth() + 1; // 9 | |
const currentYear = now.getFullYear(); // 2022 |
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 | |
//Convert standard 12 hour time to 24 hour "Military Time" using php | |
//use the PHP date functiont to format the date | |
//use PHP strtotime to convert the time to the specified format | |
function timeConversion($s) { | |
/* | |
* Write your code here. | |
*/ |
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 | |
// Complete the birthdayCakeCandles function below. | |
function birthdayCakeCandles($ar) { | |
//Count occurrance of each value in array | |
$candleCount = array_count_values($ar); | |
//This is the single higest value in the array | |
$tallestCandleCount = max($candleCount); |
NewerOlder