Comments (2)
/**
* @param n the object to be compared.
* @return a negative integer, zero, or a positive integer as the absolute value of this object is
* less than, equal to, or greater than the absolute value of the specified object.
*/
public int compareAbs(LongInteger n) {
int diff = digits.length - n.digits.length;
if (diff == 0) {
for (int i = digits.length - 1; i >= 0; i--) {
diff = digits[i] - n.digits[i];
if (diff != 0) break;
}
}
return diff;
}
According to the code here, the digits.length is the length of digits (123), which is 3, and the length of n.digits (-0), is 1. Thus the diff here would be 2.
Sorry, my first intuition on reading this comment was wrong. After reading this carefully, this object
refers to the digits, and the specified object
refers to n.
from dsa-java.
Thank you!!
from dsa-java.
Related Issues (20)
- [QZ1] Gradle Version? HOT 3
- Office Hours Passcode? HOT 1
- [QZ1] build.gradle, sourceCompatibility and targetCompatibility question HOT 1
- [QZ0] Didn't see the output
- [QZ0]java version
- Lecture Recordings HOT 1
- [QZ1] On "0" and "-0" as well as unit testing
- [QZ1] Regarding the Quiz1 submission
- zoom recording for 01/25 HOT 1
- [Quiz2] Submitting report on canvas?
- [HW1] How to know which specific test case we failed on and further debug? HOT 1
- [HW1] What is a sample criteria for "fast"?
- [QZ3] Testing Question
- Homework 2 Test case question
- Tries 03/01 lecture link missing
- [HW#2] Reading in the dictionary file
- [QZ5] Trie of countries?
- [HW2] Test HOT 1
- [HW3] Is it possible to know the running results of gold of MSTAllHwTest?
- [QZ9] Can an augmenting path contain cycle? HOT 1
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 dsa-java.