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.westudio.java; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| class Apple { | |
| public String color; | |
| public Apple(String color) { |
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.westudio.java; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.lang.reflect.Modifier; | |
| /** | |
| * Reflect experience | |
| */ | |
| class ReflectClass { |
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.westudio.java; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.Comparator; | |
| class HDTV implements Comparable<HDTV> { | |
| private int 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
| package com.westudio.java; | |
| import java.util.Arrays; | |
| import java.util.HashSet; | |
| import java.util.Set; | |
| /** | |
| * Actually, if you really need to check if a value is contained in some array/collection efficiently, | |
| * a sorted list or tree can do it in O(log(n)) or hashset can do it in O(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
| package com.ado.java; | |
| public class LeetCodeFive { | |
| private static double findMedianOfSortedArray(int[] a, int[] b) { | |
| int m = a.length; | |
| int n = b.length; | |
| if ((m + n) % 2 == 0) { | |
| // even |
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.ado.java; | |
| public class NoVisibility { | |
| private static int number; | |
| private static boolean ready; | |
| private static class ReaderThread extends Thread { | |
| @Override | |
| public void run() { |
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
| function getProperty (obj, prop) { | |
| if (obj.hasOwnProperty(prop)) { | |
| return obj[prop]; | |
| } | |
| if (obj.__proto__ !== null) { | |
| return getProperty(obj.__proto__, prop); | |
| } | |
| return undefined; |
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.westudio.java; | |
| import java.util.*; | |
| public class LeetCodeFour { | |
| private static int ladderLength(String start, String end, Set<String> dict) { | |
| if (start == null || end == null || | |
| start.equals(end) || start.length() != end.length()) { | |
| return -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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| typedef int elementType; | |
| typedef struct Node { | |
| elementType d; | |
| Node* next; | |
| } Node; |
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
| The work flow: Node_main.cc: wmain(win), main(*nix)->Node.cc: node::Start->Load->ExecuteString->node.js: startup->Module.js: Module.runMain()->Module._load->Module.prototype.load->Module._extensions['.js']->NativeModule.require('fs').readFileSync |