Skip to content

Commit

Permalink
更新 哈希表额外题目 排版格式修复
Browse files Browse the repository at this point in the history
  • Loading branch information
jinbudaily committed Jul 27, 2023
1 parent dc9fb7c commit 56f3780
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
15 changes: 8 additions & 7 deletions problems/0205.同构字符串.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

提示:可以假设 s 和 t 长度相同。

# 思路
## 思路

字符串没有说都是小写字母之类的,所以用数组不合适了,用map来做映射。

Expand Down Expand Up @@ -61,9 +61,9 @@ public:
```
# 其他语言版本
## 其他语言版本
## Java
### Java
```java
class Solution {
Expand All @@ -87,7 +87,7 @@ class Solution {
}
```

## Python
### Python

```python
class Solution:
Expand All @@ -110,7 +110,7 @@ class Solution:
return True
```

## Go
### Go

```go
func isIsomorphic(s string, t string) bool {
Expand All @@ -132,7 +132,7 @@ func isIsomorphic(s string, t string) bool {
}
```

## JavaScript
### JavaScript

```js
var isIsomorphic = function(s, t) {
Expand All @@ -156,7 +156,7 @@ var isIsomorphic = function(s, t) {
};
```

## TypeScript
### TypeScript

```typescript
function isIsomorphic(s: string, t: string): boolean {
Expand All @@ -183,3 +183,4 @@ function isIsomorphic(s: string, t: string): boolean {
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

1 change: 1 addition & 0 deletions problems/0234.回文链表.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,4 @@ function reverseList(head: ListNode | null): ListNode | null {
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

28 changes: 18 additions & 10 deletions problems/1002.查找常用字符.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ words[i] 由小写英文字母组成



# 思路
## 思路

这道题意一起就有点绕,不是那么容易懂,其实就是26个小写字符中有字符 在所有字符串里都出现的话,就输出,重复的也算。

Expand Down Expand Up @@ -140,7 +140,7 @@ public:

## 其他语言版本

Java:
### Java:

```Java
class Solution {
Expand Down Expand Up @@ -174,7 +174,8 @@ class Solution {
}
}
```
Python
### Python

```python
class Solution:
def commonChars(self, words: List[str]) -> List[str]:
Expand Down Expand Up @@ -218,7 +219,8 @@ class Solution:
return l
```

javaScript
### JavaScript

```js
var commonChars = function (words) {
let res = []
Expand Down Expand Up @@ -285,7 +287,8 @@ var commonChars = function(words) {
}
```

TypeScript
### TypeScript

```ts
console.time("test")
let str: string = ""
Expand Down Expand Up @@ -321,7 +324,8 @@ TypeScript
return str.split("")
```

GO
### GO

```golang
func commonChars(words []string) []string {
length:=len(words)
Expand Down Expand Up @@ -357,7 +361,8 @@ func min(a,b int)int{
}
```

Swift:
### Swift:

```swift
func commonChars(_ words: [String]) -> [String] {
var res = [String]()
Expand Down Expand Up @@ -397,7 +402,8 @@ func commonChars(_ words: [String]) -> [String] {
}
```

C:
### C:

```c
//若两个哈希表定义为char数组(每个单词的最大长度不会超过100,因此可以用char表示),可以提高时间和空间效率
void updateHashTable(int* hashTableOne, int* hashTableTwo) {
Expand Down Expand Up @@ -449,7 +455,8 @@ char ** commonChars(char ** words, int wordsSize, int* returnSize){
return ret;
}
```
Scala:
### Scala:
```scala
object Solution {
def commonChars(words: Array[String]): List[String] = {
Expand Down Expand Up @@ -483,7 +490,7 @@ object Solution {
}
```

Rust:
### Rust:

```rust
impl Solution {
Expand Down Expand Up @@ -522,3 +529,4 @@ impl Solution {
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

0 comments on commit 56f3780

Please sign in to comment.