牛客剑指offer:https://www.nowcoder.com/ta/coding-interviews?page=1
牛客华为机试:https://www.nowcoder.com/ta/huawei
机考题共3道题,2道简单(各100分),1道中等(200分),总分400分
需要着重练习一下简单和中等难度的题型
考得较多的知识点有:
1.字符串、排序、数组、考得多主要是看这类哦;
2、任务分配;
3、贪心;
4、栈、hash、递归、树、bfs、dfs考得很少,但也不排除。
机考攻略:链接:https://pan.baidu.com/s/1vm-8yFWWYz2LTaxWj5GzIg 提取码:ab18
机考模拟题:https://www.nowcoder.com/test/1088888/summary
import java.util.ArrayList;
import java.util.Stack;
public class Solution {
public ArrayList<Integer> printListFromTailToHead(ListNode listNode) {
ArrayList<Integer> list = new ArrayList<>();
if(listNode == null) return list;
Stack stack = new Stack();
ListNode p = listNode;
while (true) {
stack.push(p.val);
if (p.next == null) break;
else p = p.next;
}
while (!stack.isEmpty()) {
list.add((Integer) stack.pop());
}
return list;
}
}
import java.util.ArrayList;
import java.util.Stack;
public class Solution {
public ListNode ReverseList(ListNode head) {
if(head == null) return null;
ListNode p = head;
ListNode q = head.next;
while(q != null){
ListNode temp = q.next;
q.next = p;
p = q;
q = temp