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 json | |
with open('test_dictionary_regular.json') as f: | |
data = json.load(f) | |
with open('test_dictionary_dot.json') as f: | |
test = json.load(f) | |
def to_dot(data: dict) -> dict: | |
out = {} |
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
names = ['Atlantia SpA', 'Amazon.com', 'Banco Bilbao Vizcaya Argentaria SA', 'Carl Zeiss Meditec AG', 'Antofagasta PLC', 'Bunzl plc', 'SK Hynix Inc', 'Hang Seng Bank Ltd', 'Salesforce.Com', 'Kia Motors Corp', 'Zurich Insurance Group AG'] | |
suffices = ['Inc', 'LTD', 'SA', 'AG', '.com', 'Corp', 'Group', 'SPA', 'PLC'] | |
[w[:-len(s)] for w in names for s in suffices if w.lower().endswith(s.lower())] |
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
// problem: https://leetcode.com/problems/two-sum/ | |
import java.util.HashMap; | |
class Solution { | |
int[] twoSum(int[] nums, int target){ | |
int firstIndex = -1, secondIndex = -1; | |
HashMap<Integer, Integer> map = new HashMap<>(); |