Nav: << previous: 193.有效电话号码 | next: 195.第十行 >>
Description
tab: English
<p>Given a text file <code>file.txt</code>, transpose its content.</p>
<p>You may assume that each row has the same number of columns, and each field is separated by the <code>' '</code> character.</p>
<p><strong class="example">Example:</strong></p>
<p>If <code>file.txt</code> has the following content:</p>
<pre>
name age
alice 21
ryan 30
</pre>
<p>Output the following:</p>
<pre>
name alice ryan
age 21 30
</pre>
---
[submissions](https://leetcode.com/problems/transpose-file/submissions/) | [solutions](https://leetcode.com/problems/transpose-file/solutions/)
tab: 中文
<p>给定一个文件 <code>file.txt</code>,转置它的内容。</p>
<p>你可以假设每行列数相同,并且每个字段由 <code>' '</code> 分隔。</p>
<p> </p>
<p><strong>示例:</strong></p>
<p>假设 <code>file.txt</code> 文件内容如下:</p>
<pre>
name age
alice 21
ryan 30
</pre>
<p>应当输出:</p>
<pre>
name alice ryan
age 21 30
</pre>
---
[提交记录](https://leetcode.cn/problems/transpose-file/submissions/) | [题解](https://leetcode.cn/problems/transpose-file/solution/)
Solutions & Notes
properties:
note.updated:
displayName: Last Updated
note.relative_links:
displayName: Related Links
note.desc:
displayName: Description
note.grade:
displayName: Rating
note.program_language:
displayName: Language
note.time_complexity:
displayName: TC
note.space_complexity:
displayName: SC
views:
- type: table
name: Solutions & Notes
filters:
and:
- file.hasLink(this.file)
- file.tags.containsAny("leetcode/solution", "leetcode/note")
order:
- file.name
- desc
- program_language
- time_complexity
- space_complexity
- grade
- relative_links
- updated
sort:
- property: grade
direction: ASC
- property: time_complexity
direction: ASC
- property: program_language
direction: ASC
columnSize:
file.name: 104
note.space_complexity: 65
note.grade: 126
Similar Problems
properties:
note.lcTopics:
displayName: Topics
note.lcAcRate:
displayName: AC Rate
note.favorites:
displayName: Favorites
note.grade:
displayName: Rating
note.translatedTitle:
displayName: Title (CN)
note.lcDifficulty:
displayName: Difficulty
views:
- type: table
name: Similar Problems
filters:
and:
- file.hasLink(this.file)
- similarQuestions.contains(this.file)
order:
- file.name
- translatedTitle
- lcTopics
- lcDifficulty
- lcAcRate
- grade
- favorites
sort:
- property: file.name
direction: ASC
- property: lcTopics
direction: DESC
columnSize:
note.translatedTitle: 240
note.lcTopics: 347
note.lcAcRate: 75
note.grade: 122