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
| class Queue { | |
| constructor() { | |
| this.items = []; | |
| } | |
| isEmpty() { | |
| return this.items.length == 0; | |
| } |
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
| class Stack { | |
| constructor() { | |
| this.items = []; | |
| this.top = null; | |
| } | |
| getTop() { | |
| if (this.items.length == 0) | |
| return null; | |
| return this.top; |
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
| class Node { | |
| constructor (data) { | |
| this.data = data | |
| this.nextNode = null | |
| } | |
| } | |
| class LinkedList { | |
| constructor(){ |
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 { useState, useEffect } from 'react' | |
| import axios, { CancelToken } from 'axios' | |
| export default function useFetch (options) { | |
| const [data, setData] = useState(null) | |
| const [isLoading, setIsLoading] = useState(false) | |
| const [error, setError] = useState(null) | |
| useEffect(_ => { | |
| const source = CancelToken.source(); |
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'bundler/setup' | |
| require 'csv' | |
| require "pathname" | |
| require "http" |
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'bundler/setup' | |
| require 'csv' | |
| require "pathname" | |
| require "em-http-request" | |
| require "date" |
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
| package com.zaingz.test; | |
| import java.util.LinkedList; | |
| import java.util.Queue; | |
| public class NestedArrays { | |
| public static void main(String[] args) { | |
| //sample for this output [[1,2,[3]],4] -> [1,2,3,4] | |
| Object[] objArr = new Object[2]; |
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 update_file(file_name, incl) | |
| file = File.open(file_name, "r") | |
| data = file.read | |
| file.close | |
| unless data.include? "#ifndef" | |
| final_data = "#ifndef #{incl}\n#define #{incl}\n#{data}\n#endif\n/*Include guards add by Zain*/" | |
| file = File.open(file_name, "w+") | |
| file.write(final_data) | |
| file.close |