更新 哈希表额外题目 排版格式修复

This commit is contained in:
jinbudaily
2023-07-27 14:32:16 +08:00
parent dc9fb7cb0b
commit 56f37806ca
3 changed files with 27 additions and 17 deletions

View File

@ -29,7 +29,7 @@
提示:可以假设 s 和 t 长度相同。 提示:可以假设 s 和 t 长度相同。
# 思路 ## 思路
字符串没有说都是小写字母之类的所以用数组不合适了用map来做映射。 字符串没有说都是小写字母之类的所以用数组不合适了用map来做映射。
@ -61,9 +61,9 @@ public:
``` ```
# 其他语言版本 ## 其他语言版本
## Java ### Java
```java ```java
class Solution { class Solution {
@ -87,7 +87,7 @@ class Solution {
} }
``` ```
## Python ### Python
```python ```python
class Solution: class Solution:
@ -110,7 +110,7 @@ class Solution:
return True return True
``` ```
## Go ### Go
```go ```go
func isIsomorphic(s string, t string) bool { func isIsomorphic(s string, t string) bool {
@ -132,7 +132,7 @@ func isIsomorphic(s string, t string) bool {
} }
``` ```
## JavaScript ### JavaScript
```js ```js
var isIsomorphic = function(s, t) { var isIsomorphic = function(s, t) {
@ -156,7 +156,7 @@ var isIsomorphic = function(s, t) {
}; };
``` ```
## TypeScript ### TypeScript
```typescript ```typescript
function isIsomorphic(s: string, t: string): boolean { function isIsomorphic(s: string, t: string): boolean {
@ -183,3 +183,4 @@ function isIsomorphic(s: string, t: string): boolean {
<a href="https://programmercarl.com/other/kstar.html" target="_blank"> <a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/> <img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a> </a>

View File

@ -432,3 +432,4 @@ function reverseList(head: ListNode | null): ListNode | null {
<a href="https://programmercarl.com/other/kstar.html" target="_blank"> <a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/> <img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a> </a>

View File

@ -30,7 +30,7 @@ words[i] 由小写英文字母组成
# 思路 ## 思路
这道题意一起就有点绕不是那么容易懂其实就是26个小写字符中有字符 在所有字符串里都出现的话,就输出,重复的也算。 这道题意一起就有点绕不是那么容易懂其实就是26个小写字符中有字符 在所有字符串里都出现的话,就输出,重复的也算。
@ -140,7 +140,7 @@ public:
## 其他语言版本 ## 其他语言版本
Java ### Java
```Java ```Java
class Solution { class Solution {
@ -174,7 +174,8 @@ class Solution {
} }
} }
``` ```
Python ### Python
```python ```python
class Solution: class Solution:
def commonChars(self, words: List[str]) -> List[str]: def commonChars(self, words: List[str]) -> List[str]:
@ -218,7 +219,8 @@ class Solution:
return l return l
``` ```
javaScript ### JavaScript
```js ```js
var commonChars = function (words) { var commonChars = function (words) {
let res = [] let res = []
@ -285,7 +287,8 @@ var commonChars = function(words) {
} }
``` ```
TypeScript ### TypeScript
```ts ```ts
console.time("test") console.time("test")
let str: string = "" let str: string = ""
@ -321,7 +324,8 @@ TypeScript
return str.split("") return str.split("")
``` ```
GO ### GO
```golang ```golang
func commonChars(words []string) []string { func commonChars(words []string) []string {
length:=len(words) length:=len(words)
@ -357,7 +361,8 @@ func min(a,b int)int{
} }
``` ```
Swift ### Swift
```swift ```swift
func commonChars(_ words: [String]) -> [String] { func commonChars(_ words: [String]) -> [String] {
var res = [String]() var res = [String]()
@ -397,7 +402,8 @@ func commonChars(_ words: [String]) -> [String] {
} }
``` ```
C: ### C:
```c ```c
//若两个哈希表定义为char数组每个单词的最大长度不会超过100因此可以用char表示可以提高时间和空间效率 //若两个哈希表定义为char数组每个单词的最大长度不会超过100因此可以用char表示可以提高时间和空间效率
void updateHashTable(int* hashTableOne, int* hashTableTwo) { void updateHashTable(int* hashTableOne, int* hashTableTwo) {
@ -449,7 +455,8 @@ char ** commonChars(char ** words, int wordsSize, int* returnSize){
return ret; return ret;
} }
``` ```
Scala: ### Scala:
```scala ```scala
object Solution { object Solution {
def commonChars(words: Array[String]): List[String] = { def commonChars(words: Array[String]): List[String] = {
@ -483,7 +490,7 @@ object Solution {
} }
``` ```
Rust: ### Rust:
```rust ```rust
impl Solution { impl Solution {
@ -522,3 +529,4 @@ impl Solution {
<a href="https://programmercarl.com/other/kstar.html" target="_blank"> <a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/> <img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a> </a>