filmov
tv
Linked List in Java - 82: Compare two strings represented as linked lists

Показать описание
Solution:
- We've two string list of characters, so compare one by one each node value
- If at any point, first list value is smaller than second list value, return -1
- If at any point, second list value is smaller than first list value, return 1
- At last, if both list is null, return 0 as both are equal
- At last, if head1 is null but head2 is not null return -1
- At last, if head1 is not null but head2 is null return 1
- Time Complexity: O(n)
- Space Complexity: O(1) as we're taking only constant variables
Please check video for more info:
This problem is similar to:
Compare two strings represented as linked lists in java,
how to Compare two strings represented as linked lists,
Compare two strings represented as linked lists,
Compare two string,
Compare characters of two string,
linked list,
tutorial,
coding simplified,
java
CHECK OUT CODING SIMPLIFIED
★☆★ VIEW THE BLOG POST: ★☆★
I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 400+ videos.
★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
★☆★ SEND EMAIL At: ★☆★
LinkedList vs ArrayList in Java Tutorial - Which Should You Use?
Learn Linked Lists in 13 minutes 🔗
Linked List Java Tutorial #67
#5 Linked List Implementation in Java Part 1 | Data Structures
Linked List Tutorial - Singly + Doubly + Circular (Theory + Code + Implementation)
Singly Linked List | Insert, Delete, Complexity Analysis
Linked lists in 4 minutes
Understanding and implementing a Linked List in C and Java
🔥TCS Smart Ignite Coding Questions ONE SHOT | TCS Smart and Ignite Hiring 2025 Preparation
Introduction to Linked List
Java: Linked Lists Explained
Linked List in Java
ArrayList vs. LinkedList 🔥 Kennst du den Unterschied? - Java Programmieren Lernen
Java Tutorial - Creating LINKED LISTS
Complete Java LinkedList Tutorial for Beginners (With Coding Examples) 🔥 2025
P48 - LinkedList in Java | Collections | Core Java | Java Programming |
Introduction to Linked List | Data Structures & Algorithms | Java Placement Course
Implementation of Linked List in Java - Part 1| Data Structures in Tamil | Logic First Tamil
Introduction to Linked Lists (Data Structures & Algorithms #5)
Linked lists aren't real
14.5 LinkedList vs ArrayList in Java
The Majestic Battle of Circular Linked Lists! 🔁💥
Linked List in Java | Java Linked Explained | Data Structures Implementation | Edureka
#013 [Data Structures] - Introduction To Linked List
Комментарии