Instantly share code, notes, and snippets.

# Nate theredpea

Last active October 27, 2023 18:37
code_challenge_reduction_question

Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science knowledge)

Consider an array A of N integers. You can delete zero or more of its elements.

Then take the remaining elements and reduce to an integer S according to these rules:

• elements in even positions are added
• elements in odd positions are subtracted: e.g. S = A[0] − A[1] + A[2] − A[3] + ...
Created October 25, 2023 00:37
Equilateral Triangles Overlap Area.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active October 27, 2023 18:23
Code Challenges
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 solution that, given a string S consisting of N letters 'a' and/or 'b' returns true when all occurrences of letter 'a' are before all occurrences of letter 'b' and returns false otherwise. Examples: 1. Given S = "aabbb", the function should return true. 2. Given S = "ba", the function should return false. 3. Given S = "aaa", the function should return true. Note that 'b' does not need to occur in S.
Last active October 13, 2023 18:01
Learning SortedList
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
 using System; using System.Collections.Generic; using System.Linq; // Online C# Editor for free // Write, Edit and Run your C# code using C# Online Compiler class Solution { // TODO: maybe dont need to store class/object TradingEvent public class TradingEvent {
Created October 12, 2023 23:07
Technical Challenge Interview
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
 /******************/ /**** Solution ****/ /******************/ function emboldenSubstrings(input, substrings) { // Implement me! // if (!substrings.length) { // return input; // }
Created May 29, 2023 21:56

### Steps to reproduce

1. Using Windows 10 laptop, following instructions here, run `docker run -d -p 80:80 owncloud`
2. Open owncloud on localhost:80 , setup the admin username and password, navigate to marketplace

### Expected behaviour

Can reach marketplace

### Actual behaviour

Marketplace throws error:

Created December 17, 2022 22:13
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
 ['2014', '2015','2016','2017','2018','2019','2020','2021','2022'].map(year=>{ return ['01','02','03','04', '05','06','07','08','09','10','11','12'].map(month=>[year, month]);}).flat() .forEach(async ([year, month])=>{ let fetch_url = `https://www.mybenefitwallet.com/BW/activities/eStatement?year=\${year}&month=\${month}`; // https://stackoverflow.com/a/24586168/1175496 await fetch(fetch_url) .then(response => response.blob()) .then(blob => { var url = window.URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url;
Last active October 30, 2022 17:42
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(`Hello Nate! Hope today's Beerfest was a success. So Elizabeth Johnson had signed up for a monthly membership but was double billed for both June and July for a total of \$70. Can we reimburse her? Her Venmo account is @E.Johnson-2496. Thanks. Can you verify that she has cancelled her monthly membership? She now would like to pay month to month.`); // club.spond.com ///============================= ///============================= ///============================= ///============================= const squid_spond_clubid = "39004B1375F244F4AFECC14513031501" const fetch_opts = { "credentials": "include", "mode": "cors",
Last active November 9, 2022 04:50
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
 // club.spond.com ///============================= ///============================= ///============================= ///============================= const squid_spond_clubid = "39004B1375F244F4AFECC14513031501" const fetch_opts = { "credentials": "include", "mode": "cors", };
Last active February 11, 2023 00:23
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
 function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel, appendString) { //If JSONData is not an object then JSON.parse will parse the JSON string in an Object var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData; var CSV = ''; //This condition will generate the Label/Header if (ShowLabel) { var row = ""; //This loop will extract the label from 1st index of on array