Skip to content

Instantly share code, notes, and snippets.

View Devonte202's full-sized avatar
🛠️
Building

Devonte G. Duncan Devonte202

🛠️
Building
View GitHub Profile
def itemsSort(items):
sortedByValue = sorted(items)
inventory = {}
for value in sortedByValue:
if value not in inventory:
inventory[value] = 1
elif value in inventory:
inventory[value] += 1
listOfLists = []
for item, quantity in inventory.items():
/*
* Algorithm
*
* Data structures: Array
* 1. concatenate n, k times to create p
* 2. iterate through p to find the sum of all individual integers in p
* 3. iterate through sum of p to find the sum of all individual integers
* 4. repeat until length of p is less than 2, then return p
*
*/
@Devonte202
Devonte202 / circular_printer.py
Created August 12, 2020 14:45
Circular Printer Solution
import string
from collections import Counter
def getTime(s):
#set up
dictionary = Counter(string.ascii_uppercase)
num = 1
for letter in dictionary:
dictionary[letter] = num
num += 1
@Devonte202
Devonte202 / Roomba Solution
Created July 3, 2020 18:57
Solution to the infamous Roomba question
/**
returns whether roomba ever hits the starting point facing the starting direction
(0, 0) is the (x, y) starting point, facing right
moves is an even length array
even indexes are amount to move
odd indexes are either R or L to rotate 90 degrees right or left
*/
def newPassword(a, b):
newWord = ""
for char in range(len(a)):
newWord += a[char]
newWord += b[char]
return newWord
import React, { useEffect, useState } from "react";
import axios from "axios";
function UserCard({ userId }) {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchUser = async () => {
try {
setLoading(true);
const { data } = await axios.get(
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
#coverpic{
height:610px;
width:100%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var yourName = prompt("What is your name?");
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.die {
border: 1px solid black;
height: 75px;