java interview question - if a string has unique characters part-2 [ cracking the coding interview ]

Опубликовано: 03 Ноябрь 2024
на канале: Java Essential
2,205
25

Please watch this video on 720p or 1080p for better visibility

if a string has all unique characters no additional DS avail part-2
This approach is much faster than last one.

function never has to test any string of length 27 or greater. Therefore, the inner loop runs at most 26 times. Each iteration does O(1) work in bitwise operations,
so the overall work done is (O(1) iterations times * O(1) work per iteration) so it's O(1),
which is significantly faster.

Please watch this video on 720p or 1080p for better visibility

Facebook page -   / javaessential  
Email - [email protected]
Website - http://www.javaessential.com