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
| #include <cstring> | |
| #include <iostream> | |
| using namespace std; | |
| int main(){ | |
| string s; | |
| string t; | |
| s = "ABBCADEEFAHASGFASFASJJJEF"; | |
| t = "SFASJJ"; | |
| // Naive String matching algorithm. |
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
| #include <iostream> | |
| #include <cstring> | |
| #include <fstream> | |
| #include <map> | |
| int main(void){ | |
| std::string text; | |
| std::string pattern; | |
| // Read the text from the file. |
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
| #include <iostream> | |
| #include <cstring> | |
| #include <vector> | |
| #include <algorithm> | |
| bool sortFunction(std::string s1, std::string s2){ | |
| if(s1[0] < s2[0]) return true; | |
| if(s2[0] < s1[0]) return false; | |
| int i = 0; | |
| int min = s1.size() < s2.size() ? s1.size() : s2.size(); |
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
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <cassert> | |
| bool sortFunction(std::string s1, std::string s2){ | |
| if(s1[0] < s2[0]) return true; | |
| if(s2[0] < s1[0]) return false; | |
| int i = 0; | |
| int min = s1.size() < s2.size() ? s1.size() : s2.size(); |
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 numpy as np | |
| import pandas as pd | |
| from scipy.ndimage.interpolation import shift | |
| import cv2 | |
| from matplotlib import pyplot as plt | |
| input_photo_path = "/kaggle/input/84474892_2612930752149692_1911641796866211840_o.jpg" | |
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
| // Author : Sandesh Bhusal | |
| // Date Feb 23, 2021 | |
| // You may copy, download and modify the source code according to your requirements :) | |
| // Happy Spoofing! | |
| // Original Code Lives at https://gist.github.com/sandeshbhusal/c8fa09546ffc076e5103456dd4e3742d | |
| package main | |
| import ( | |
| "flag" |
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
| // Author : Sandesh Bhusal | |
| // Date Feb 23, 2021 | |
| // You may copy, download and modify the source code according to your requirements :) | |
| // Happy Spoofing! | |
| // Original Code Lives at https://gist.github.com/sandeshbhusal/c8fa09546ffc076e5103456dd4e3742d | |
| package main | |
| import ( | |
| "flag" |
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
| use scan_fmt::{scan_fmt}; | |
| use std::{fs::File, io:: {BufRead, BufReader}}; | |
| fn main(){ | |
| let file_path : String = String::from("src/input.txt"); | |
| let bufreader = BufReader::new(File::open(file_path).expect("Could not open file")); | |
| let correct_passwords = bufreader.lines().map(|_line| { | |
| match scan_fmt!(&_line.unwrap(), "{}-{} {}: {}" , i32, i32, char, String) { | |
| Ok((a, b, c, d)) => { | |
| if a <= d.chars().map(|k| { if c == k {1} else {0} } ).sum::<i32>() && b>= d.chars().map(|k| { if c == k {1} else {0} } ).sum::<i32>() { | |
| 1 |
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
| from typing import * | |
| class State(object): | |
| ''' | |
| Terminal states do not change their values | |
| ''' | |
| def __init__(self, id: int, value: int, transitions: List[int], is_terminal: bool) -> None: | |
| self.id = id | |
| self.value = value | |
| self.transitions = transitions |
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
| grid = [[-1] * 5 for i in range(0, 4)] | |
| grid[0][2] = -100000 | |
| grid[0][4] = 1000 | |
| grid[1][2] = -100000 | |
| grid[3][3] = -100 | |
| final_states = [ | |
| (0, 2), | |
| (0, 4), |
OlderNewer