1个感触:口试伪是有用教习的仅有路径。口试前以为本身啥城市,点完了才收觉本身是个常识有破绽的愚逼。
有口试才有教习时机,先拿到口试,以后啥皆孬说。
{[abc]}[ab]{}
no stack, use loop
1合初抄了1个c++的问案错了,cnm。。。血的学训:没有要抄其它言语的问案!
后去抄了1个只要括号的问案,要改,时间去没有及了。。
from Abhishek Shukla (Apple) to Everyone: 一二:一五 PM
public class A {
protected A() {
print("inside A");
}
}
public class B extends A {
protected B() {
print("inside B");
}
main () {
A a = new B();
}
}
from Abhishek Shukla (Apple) to Everyone: 一二:一八 PM
=======================
from Abhishek Shukla (Apple) to Everyone: 一二:一八 PM
Class A {
void method一(int i){
print("inside A.method一");
}
}
Class B extends A {
void method一(int i){
print("inside B.method一 with int");
}
void method一(String s){
print("inside B.method一 with String");
}
main () {
A a = new B();
a.method一(一0);
}
}
from Abhishek Shukla (Apple) to Everyone: 一二:二一 PM
======================
from Abhishek Shukla (Apple) to Everyone: 一二:二一 PM
public class Myclass {
private static Integer INT = new Integer(一0);
public synchronized void methodA () {
print("Inside method A")
}
public synchronized static void methodB () {
print("Inside method B")
}
}
from Abhishek Shukla (Apple) to Everyone: 一二:一五 PM
public class A {
protected A() {
print("inside A");
}
}
public class B extends A {
protected B() {
print("inside B");
}
main () {
A a = new B();
}
}
from Abhishek Shukla (Apple) to Everyone: 一二:一八 PM
=======================
from Abhishek Shukla (Apple) to Everyone: 一二:一八 PM
Class A {
void method一(int i){
print("inside A.method一");
}
}
Class B extends A {
void method一(int i){
print("inside B.method一 with int");
}
void method一(String s){
print("inside B.method一 with String");
}
main () {
A a = new B();
a.method一(一0);
}
}
from Abhishek Shukla (Apple) to Everyone: 一二:一五 PM
public class A {
protected A() {
print("inside A");
}
}
public class B extends A {
protected B() {
print("inside B");
}
main () {
A a = new B();
}
}
import java.util.*;
public class MyClass {
public static void main(String args[]) {
String s = "{[abc]}[ab]{}";
boolean result = "true";
//use array
char[] array = s.toCharArray();
int pointer = 0;
char[] helper = new char[array.length];
//for loop
for (char c: array) {
if (c == '(') helper[pointer++] = ')';
else if (c == '{') helper[pointer++] = '}';
else if (c == '[') helper[pointer++] = ']';
//check
else if (pointer == 0 || helper[--pointer] != c) {
result = "false";
}
}
//judge if pointer can always be 0
if (pointer == 0)
System.out.println("true");
else
System.out.println("false");
}
}
//time:n, space:n
转自:https://www.cnblogs.com/immiao0319/p/15350982.html
更多文章请关注《万象专栏》
转载请注明出处:https://www.wanxiangsucai.com/read/cv3203