Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 800189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:15:14+00:00 2026-05-14T23:15:14+00:00

Suppose I have a list of strings where each string is exactly 4 characters

  • 0

Suppose I have a list of strings where each string is

  • exactly 4 characters long and
  • unique within the list.

For each of these strings I want to identify the position of the characters within the string that make the string unique.

So for a list of three strings

abcd
abcc
bbcb

For the first string I want to identify the character in 4th position d since d does not appear in the 4th position in any other string.

For the second string I want to identify the character in 4th position c.

For the third string it I want to identify the character in 1st position b AND the character in 4th position, also b.

This could be concisely represented as

abcd -> ...d
abcc -> ...c
bbcb -> b..b

If you consider the same problem but with a list of binary numbers

0101
0011
1111

Then the result I want would be

0101 -> ..0.
0011 -> .0..
1111 -> 1...

Staying with the binary theme I can use XOR to identify which bits are unique within two binary numbers since

0101 ^ 0011 = 0110

which I can interpret as meaning that in this case the 2nd and 3rd bits (reading left to right) are unique between these two binary numbers. This technique might be a red herring unless somehow it can be extended to the larger list.

A brute-force approach would be to look at each string in turn, and for each string to iterate through vertical slices of the remainder of the strings in the list.

So for the list

abcd
abcc
bbcb

I would start with

abcd

and iterate through vertical slices of

abcc
bbcb

where these vertical slices would be

a | b | c | c
b | b | c | b

or in list form, “ab”, “bb”, “cc”, “cb”.

This would result in four comparisons

a : ab -> . (a is not unique)
b : bb -> . (b is not unique)
c : cc -> . (c is not unique)
d : cb -> d (d is unique)

or concisely

abcd -> ...d

Maybe it’s wishful thinking, but I have a feeling that there should be an elegant and general solution that would apply to an arbitrarily large list of strings (or binary numbers). But if there is I haven’t yet been able to see it.

I hope to use this algorithm to to derive minimal signatures from a collection of unique images (bitmaps) in order to efficiently identify those images at a future time. If future efficiency wasn’t a concern I would use a simple hash of each image.

Can you improve on brute force?

Edit
The approach I’m warming to is building a map of pixels to images

sprawl[Tuple<x=10, y=33,color=f1fefd>] => {
     image17,
     image23,
     ...
}

sprawl[Tuple<x=10, y=34,color=f1fef0>] => {
     image11
     ...
}

and then using that map to identify the minimal set of signature pixels for each image.

If a pixel (identified by x, y, color) references just one image then I have found a perfect (minimal) signature for that image.

It’s more complicated if an image has no unique pixels, but since I know all images are unique within the list I should be able to combine two or more pixel references (but as few as possible) to deduce the image.

Update

I’ve been working on an algorithm for this. My problem is very similar to this one, and I’ve written up my algorithm as an answer to that question. This update is to flag the attention of anyone still following (I see five bookmarks). I’m working on this in isolation so any and all feedback is welcome, even if just to observe that I haven’t made myself clear!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:15:15+00:00Added an answer on May 14, 2026 at 11:15 pm

    You can generate a two dimensional array which will contain the number of times each character appears in each position (0-3). For example, arr[1,3] will contain the number of times the digit/character 1 appears in the last position.

    Then for each string s, go over all characters in the string. The ones which appear only once in that position according to the array are the unique characters for that string. In other words, if arr[s[i], i]==1 Then string s is unique in position i.

    This will give you the solution in linear time, while the algorithm you gave will take quadratic time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a List[Int] , and I want to call toString on each
Suppose I have one string list may have duplicated items: A B C A
I have a long list of arbitrary strings and I'd like to determine if
I have a list of strings (a List<String> ) that can have anywhere from
Suppose I have one list: IList<int> originalList = new List<int>(); originalList.add(1); originalList.add(5); originalList.add(10); And
Suppose I have a drop-down list like: <select id='list'> <option value='1'>Option A</option> <option value='2'>Option
Suppose I have a collection (be it an array, generic List, or whatever is
Suppose I have a small inheritance hierarchy of Animals: public interface IAnimal { string
suppose I have a domain classes: public class Country { string name; IList<Region> regions;
Suppose i have class Person { public int Id {get;set;} public string Name {get;set;}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.