Skip to content

Instantly share code, notes, and snippets.

package main
import "testing"
func belongsToMap(imei string) bool {
list := map[string]bool{
"990008982968575": true,
"990008983020525": true,
"990008982964921": true,
"990008982968500": true,
class Solution:
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
m = {}
for i, num in enumerate(nums):
if not num in m:
@twsiyuan
twsiyuan / leetcode-27.py
Created October 30, 2018 17:49
LeetCode #27
# https://leetcode.com/problems/remove-element/
class Solution:
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
run = 0
@twsiyuan
twsiyuan / leetcode-20.py
Last active December 23, 2021 10:49
LeetCode #20
# https://leetcode.com/problems/valid-parentheses/
class Solution:
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
stack = []
for c in s:
if c == ")" or c == "]" or c == "}":
@twsiyuan
twsiyuan / example.shader
Last active October 6, 2017 05:02
SpriteShaderUnity5.6
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Custom/MySprite"
{
Properties
{
[PerRendererData]_MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
[HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1)
2017-08-09 14:28:06.098453+0800 testapp[1086:1664938] [DYMTLInitPlatform] platform initialization successful
2017-08-09 14:28:06.231939+0800 testapp[1086:1664928] [Firebase/Analytics][I-ACS036002] Firebase screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2017-08-09 14:28:06.232 testapp[1086] <Info> [Firebase/Analytics][I-ACS036002] Firebase screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2017-08-09 14:28:06.311456+0800 testapp[1086:1664884] -> registered mono modules 0x1010d2320
2017-08-09 14:28:06.528320+0800 testapp[1086:1664884] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNoti
@twsiyuan
twsiyuan / exercise-fibonacci-closure.go
Last active June 13, 2017 08:39
exercise-fibonacci-closure.go
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n := 0
fn2 := 1
fn1 := 1
using System;
[Serializable]
class AssetBundleLoadConfigs
{
public AssetBundleLoadData[] AssetBundles;
}
public void DecodeTEST(string uri, string bearer)
{
var u = new System.Uri(uri, System.UriKind.RelativeOrAbsolute);
var args = HttpUtility.ParseQueryString(u.Query).Get("args");
Debug.Log("READ Query: args = " + args);
using (var aes = new AesCryptoServiceProvider())
{
aes.Mode = CipherMode.CBC;
@twsiyuan
twsiyuan / file-chunk-md5-calculator.go
Last active April 7, 2017 03:42
Calculate md5 from file chunk using golang
package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"os"
)