Comments (3)
Hi @Erica-Iris
if hasChange
is false, it will never go into the outer for loop.
from leetcode.
Hi @Erica-Iris
if
hasChange
is false, it will never go into the outer for loop.
I'm sorry that I was too anxious and didn't look carefully, which caused trouble to everyone.
from leetcode.
HERE
It should be like thisprivate static void bubbleSort(int[] nums) { boolean hasChange = **false**; for (int i = 0, n = nums.length; i < n - 1 && hasChange; ++i) { hasChange = false; for (int j = 0; j < n - i - 1; ++j) { if (nums[j] > nums[j + 1]) { swap(nums, j, j + 1); hasChange = true; } } } }
from leetcode.
Related Issues (20)
- 1891 Cutting Ribbons HOT 2
- Give me invite to join your team HOT 1
- No.2715 中文md也是英文的,但是官方是中文的 HOT 2
- Add Rust code formatting tool HOT 3
- New documentation framework for doocs/leetcode | 为 doocs/leetcode 选择一款新的文档框架 HOT 4
- 代码切换UI消失 HOT 1
- LeetCode Wiki 网站首页重新设计 HOT 3
- LeetCode Wiki 网站分类标签问题 HOT 2
- 表达偏差 HOT 1
- Incorrect solution - 3164. Find the Number of Good Pairs II HOT 1
- Build a Docker image for doocs/leetcode | 为 doocs/leetcode 构建 Docker 镜像 HOT 1
- Iterating in array HOT 2
- 剑指算法
- 0003.Longest Substring Without Repeating Characters java有错误 HOT 1
- 为什么readme的目录连接在idea中点不进去啊 HOT 2
- 需要更新 LCP 题目 HOT 1
- How often the pool is updated? HOT 4
- Issue 剑指 Offer II 050. 向下的路径节点之和 c++ answer HOT 1
- 🐛bug: No.1599 文档格式出错 HOT 1
- 我想问下使用的是vscode吗 可以直接一个项目刷这么多语言?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leetcode.