This file contains hidden or 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
| def delete(self, value): | |
| current_node = self.head | |
| previous_node = None | |
| while current_node: | |
| if current_node.value == value: | |
| previous_node.next = current_node.next | |
| break | |
| previous_node = current_node | |
| current_node = current_node.next |
This file contains hidden or 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 negCheck (num1, num2) { | |
| return [ | |
| ( | |
| (num1 < 0 && num2 > 0) || | |
| (num1 > 0 && num2 < 0) | |
| ), | |
| ]; | |
| } | |
| function divide(x, y) { |
This file contains hidden or 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
| string = "I like parentheticals (a lot). Sometimes(when I nest them(my parentheticals) too much (like | |
| this(and this))), it get confusing." | |
| def parentheticals_open_close_position(str) | |
| starting_parentheticals = [] | |
| ending_parenthetical = [] | |
| str.each_char.with_index do |char, index| | |
| if char == '(' | |
| starting_parentheticals << index | |
| end |
This file contains hidden or 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
| import React from 'react'; | |
| import FacebookAuth from 'react-facebook-auth'; | |
| const authenticate = response => { | |
| const headers = new Headers(); | |
| headers.append('Content-Type', 'application/json'); | |
| fetch('http://localhost:3000/api/v1/auth/oauth_login', { | |
| method: 'POST', | |
| headers, | |
| body: JSON.stringify({ |
This file contains hidden or 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
| # frozen_string_literal: true | |
| scope_array = 100.times.map{Random.rand(0...100)} | |
| def binary_search_tree(target, scope, carry_over = 0) | |
| p scope.sort | |
| if scope.length <= 1 | |
| target == scope.first ? carry_over : -1 | |
| else | |
| half = scope.length / 2 | |
| if scope[half] == target |
This file contains hidden or 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
| string = "I like parentheticals (a lot). Sometimes(when I nest them(my parentheticals) too much (like | |
| this(and this))), it get confusing." | |
| def parentheticals_open_close_position(str) | |
| starting_parentheticals = [] | |
| ending_parenthetical = [] | |
| str.each_char.with_index do |char, index| | |
| if char == '(' | |
| starting_parentheticals << index | |
| end |
This file contains hidden or 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
| # initialize stock_prices_yesterday array | |
| stock_prices_yesterday = []; | |
| # fill it with random values just for theory sake | |
| stock_prices_yesterday << 10.times.map { rand(1000)} | |
| # flatten array so that it is only 1 array and not a multidimensional array | |
| stock_prices_yesterday.flatten! | |
| def get_max_profit(stock_prices_yesterday) |
This file contains hidden or 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
| var weaponArray = ['rock', 'paper', 'scissors']; | |
| var playerOne; | |
| var playerTwo; | |
| var playerOneScore = 0; | |
| var playerTwoScore = 0; | |
| while (playerOneScore < 3 && playerTwoScore < 3) { |
NewerOlder