Word Search
Word SearchLeetcode 79.
Version 1Although the backtracking method of this version is based on the backtracking algorithm template I summarized, the time complexity and space complexity are a bit high.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455class Solution { private static final int[][] direction = {{0,1},{0,-1},{-1,0},{1,0}}; public boolean exist(char[][] board, String wo ...
Restore IP Addresses
Restore IP AddressesLeetcode 93.
123456789101112131415161718192021222324252627282930313233343536373839class Solution { public List<String> restoreIpAddresses(String s) { List<String> addresses = new ArrayList<>(); StringBuilder tempAddress = new StringBuilder(); backtricking(s,addresses,tempAddress,0); return addresses; } private void backtricking(String input,List<String> address,StringBuilder tempAddress,int k){ //recursio ...
Backtricking Algorithm
回溯算法(Backtricking) 回溯逻辑部分一般存在递归函数下面
解决那些问题
组合问题
Eg: 给定 {1,2,3,4} 集合, 找到大小为2的组合。
切割问题
Eg:给定一串字符串,特定条件下,问有几种切割的方式。
子集问题
Eg: 给定 {1,2,3,4} 集合,找到它的所有子集。
排列问题
Eg: 讲顺序的组合问题
棋盘问题
Eg: N-Queen 和 解数独
Tips
把回溯法问题最好抽象成图形结构,比如树结构。更好的方便理解。
树的宽度,就是处理问题集合的大小。 这里通常用for循环遍历
树的深度,就是递归函数的深度。 这里就是递归函数处理
回溯就是递归的过程
递归就一定有终止条件。
在这里递归函数没有返回值
模板
1234567891011121314public void backtricking(parameters){ //递归终止 和 收集结果 if(终止条件){ // 收集结果 return; } ...
8-31-9-6-schedule
title: 8-31-9-6-scheduledate: 2020-08-30 20:14:00tags: schedulecategories: schedule
8/30–9/06 schedule
Time
Mon
Tue
Wed
Thu
Fri
Sat
Sun
8:00 am - 10:00 am
FIT5147 ASSESS
FIT5140 Lecture
FIT5140 ASSESS
练习 听力 + FIT5140
练习听力 + Leetcode Java
记单词+ Leetcode Java
记单词+ Leetcode Java
10:00 am - 12: 00 am
leetcode Java + interview
FIT5140 lab 作业
FIT5163 LEC
Leetcode Java
FIT5147 Lec
接Min
Leetcode Java
12:00pm - 1:50pm
吃饭 && 午睡
吃饭 && 午睡
FIT5163 LEC
吃饭 && 午睡
FIT5042 lab
...
FIT5042 JSF
Lecturer 讲得太尴尬了。每次两小时的tutorial,讲10分钟要做什么然后就自己开始照着资料做。很多概念也没讲,这门课真的小白从到一点点学。
JSFJSF(JavaServer Faces)是基于服务端组件的用户界面框架。JSF 的优势之一是不仅是Java Web用户界面标准还是遵循MVC设计模式的框架。清晰的WEB应用程序的行为和呈现之间的分离。 用户界面代码(V), 应用程序数据和逻辑(M). 为了防止对页面未授权或不正当的访问,所有与应用程序的用户交互均由一个前端”Faces” servlet (C) 来处理。 V–>视图 M—>模型 C—> 控制器。
ServletServlet是什么
Java Servlet 是作为Http 客户端的请求和数据库的之间的中间层。
Java Bean Java Bean 就是一个java 普通的类,通常用来实现一些比较常用的简单功能,并可以很容易被重复使用或者插入其他应用中去。Java Bean 是一种组件技术,就像是做了一个扳手,而这个扳手可以在很多地方使用,也可以提供很多功能(扳,锤,撬), 而这个扳手 ...
Leetcode Array 3
Remove ElementQuestion * Easy *Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn’t matter what you leave beyond the new length.Example 112345Given nums = [3,2,2,3], val = 3,Your function should return length = 2, with the first two elements of nums b ...
8/10-8/16 schedule
8/10-8/16 schedule
Time
Mon
Tue
Wed
Thu
Fri
Sat
Sun
8:00 am - 10:00 am
FIT5147 Lab 预习
FIT5140 Lecture
练习听力 + 预习FIT5042
练习 听力 + SWIFT
练习听力 + Leetcode Java
记单词+ Leetcode Java
记单词+ Leetcode Java
10:00 am - 12: 00 am
leetcode Java
练习 SWIFT
预习FIT5042
Leetcode Java
FIT5147 Lec
接Min
Leetcode Java
12:00pm - 1:50pm
吃饭 && 午睡
吃饭 && 午睡
FIT5042 Lab
吃饭 && 午睡
吃饭 && 午睡
休息
吃饭 && 午睡
2:00 pm - 4: 00 pm
练习FIT5147 lab内容
预习FIT5202
FIT5042 Lab + 锻炼
预习FIT5042(Sprin ...
Leetcode Array 2
Remove Duplicates from Sorted ArrayQuestion * Easy *Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
Hints:Example 112345Given nums = [1,1,2],Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively.It doesn't matter what you leave bey ...
Leetcode Array 1
Two SumQuestion * Easy *Given an array of integers, return indices of the two numbers such that they add up to a specific target. (You may assume that each input would have exactly one solution, and you may not use the same element twice.)Hints:1234Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].
My Solution123456789101112131415161718192021class Solution { public int[] twoSum(int[] nums, int target) { int r ...
8/03-8/09 schedule
8/03-8/09 schedule
Time
Mon
Tue
Wed
Thu
Fri
Sat
Sun
8:00 am - 10:00 am
FIT5147 Lab
FIT5140 Lecture
练习听力 + Leetcode Java
练习 听力 + SWIFT
练习听力 + Leetcode Java
记单词+ Leetcode Java
记单词+ Leetcode Java
10:00 am - 12: 00 am
Leetcode Java
练习 SWIFT
预习FIT5042
Leetcode Java
FIT5147 Lec
休息
Leetcode Java
12:00pm - 1:50pm
吃饭 && 午睡
吃饭 && 午睡
FIT5042 Lab
吃饭 && 午睡
吃饭 && 午睡
休息
吃饭 && 午睡
2:00 pm - 4: 00 pm
FIT5137 Lab
预习FIT5042(Spring MVC)
FIT5042 Lab + 锻炼
预习FIT ...