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
| # Given a 2D board and a word, find if the word exists in the grid. | |
| # | |
| # The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once. | |
| # | |
| # For example, | |
| # Given board = [ | |
| # ['A','B','C','E'], | |
| # ['S','F','C','S'], | |
| # ['A','D','E','E'] | |
| # ] |
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 generateParenthesis(n): | |
| list = [] | |
| backtrack(list, "", 0, 0, n) | |
| return list | |
| def backtrack(list, str, open, close, max): | |
| if (len(str) == max * 2): | |
| list.append(str) | |
| return |
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 solve(str): | |
| standardStr = 'hackerrank' | |
| i = 0 | |
| count = 0 | |
| for j in str: | |
| if j == standardStr[i]: | |
| i += 1 | |
| count += 1 | |
| if count == len(standardStr): |
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
| /*https://www.hackerrank.com/challenges/sherlock-and-valid-string?h_r=next-challenge&h_v=zen*/ | |
| function isValid(str){ | |
| // Complete this function | |
| var map = new Map(); | |
| for(var i=0; i < str.length;i++){ | |
| if(map.has(str.charAt(i))){ | |
| map.set(str.charAt(i),map.get(str.charAt(i))+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
| INSERT INTO black_list.dbo.Block_list_4G | |
| SELECT ANI, | |
| GETDATE(), | |
| 0 | |
| FROM cskh_hds.dbo.t_Termination_Call_Detail | |
| where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
| and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
| group by ANI having count(ANI) >=10 | |
| UNION |
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 code_fight; | |
| /** | |
| * Created by Hoan Nguyen on 6/10/2017. | |
| * https://codefights.com/interview/d8oFgW9dnFgTrfhsX/companies/N3sScnJbzdPDQaHPj | |
| */ | |
| public class bomber { | |
| static int bomber(char[][] field) { | |
| int max = 0; | |
| if (field.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
| package code_fight; | |
| import java.util.Arrays; | |
| import java.util.HashSet; | |
| import java.util.Set; | |
| /** | |
| * Created by Hoan Nguyen on 3/15/2017. | |
| */ |
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
| /** | |
| * Created by Albert Hoan on 2/28/2017. | |
| */ | |
| function solveSudoku(board) { | |
| if (board == null || board.length == 0) | |
| return; | |
| solve(board); | |
| } |
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
| /** | |
| * Created by Albert Hoan on 2/27/2017. | |
| */ | |
| //input: str = '123abc4xyz' => output: sum=123+4=127 | |
| //input: str= '1abc34' => output= 35; | |
| function decodeNumber(str) { |
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 os | |
| res = [] | |
| def readFolder(file): | |
| if os.path.isfile(file): | |
| res.append(os.path.getsize(file)) | |
| else: | |
| arr = os.listdir(file) | |
| for element in arr: |