Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Naming
DSA

Naming

Master Array Patterns concepts for competitive exams.

Rule: Verb + Object.

Weak

public int solve(int[] nums)

Strong

public int findMaximumSubarraySum(int[] numbers)

Clear intent. No guessing required.


Boolean Naming

Always begin with:

  • is
  • has
  • can
  • should
boolean valid;
boolean isValidInput;
boolean hasCycle;

Variable Naming

Describe meaning, not type.

int m;
Map<Integer, Integer> hm;
int maximumSum;
Map<Integer, Integer> valueToIndex;

Readable > short.

My Private Notes

Notes are auto-saved locally to this device.