Challenge: 


  Print set intersections.


Specifications: 


  Your program should accept as its first argument a path to a filename.
  Each line in the file is a test case.
  Each test case contain two semicolon delimited sorted lists of numbers in ascending order, whose numbers are separated by a comma.
  
  Print out the ascending order sorted intersection of the lists, one per line.
  Print empty new line in case the lists have no intersection


Solution:

import java.io.File;
import java.io.FileNotFoundException;
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class SetIntersection {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner input = new Scanner(new File(args[0]));
        String[] parts;

        while (input.hasNextLine()) {
            parts = input.nextLine().split(";");

            System.out.println(
                findIntersection(
                    toIntArray(parts[0].split(",")),
                    toIntArray(parts[1].split(","))
                )
            );
        }
    }

    private static String findIntersection(int[] foo, int[] bar) {
        Set&lt;Integer&gt; intersection = new LinkedHashSet&lt;&gt;();

        for (int i = 0, j = 0; i &lt; foo.length; i++) {
            while (foo[i] &gt; bar[j] &amp;&amp; j &lt; bar.length) {
                j++;
            }
            if (foo[i] &lt; bar[j]) {
                continue;
            } else {
                intersection.add(bar[j++]);
            }
        }

        if (intersection.isEmpty()) {
            return ""; // none found
        }

        String result = intersection.toString();
        return result.substring(1, result.length() - 1);
    }

    private static int[] toIntArray(String[] array) {
        int[] nums = new int[array.length];

        for (int i = 0; i &lt; array.length; i++) {
            nums[i] = Integer.parseInt(array[i]);
        }

        return nums;
    }
}


Sample Input: 


  9,10,11;33,34,35
  3,7,8,22;11,22
  11,12,13,14;14,15,16
  20,21,22;45,46,47
  77,78,79;78,79,80,81,82
  33,35;3,18,26,35


Sample Output:


  
  22
  14  
  
  78, 79
  35


I wanted to take advantage of the fact the lists were sorted, but I fear my efforts only served to render my code convoluted and inefficient. What do you think?


Question: Does tagging content affect SEO?
Answer: The tags won't affect the pages directly by being on that page (although I am sure someone will say having the tag will increase your keyword density but I wouldn't even give too much thought to that). So adding tags in the hopes that they are directly a ranking factor would not be a good use of time.

How it can help SEO is when you have a dedicated page(s) for each tag that page will be naturally optimized for that keyword. That page will (theoretically) potentially rank well for it. That page can then drive traffic and potential link givers to pages tagged with that keyword. Also, the interlinkng by your pages will help to increase each page's PR as well as boost each other's rankings due to the advantages of anchor text and everything else incoming links have to offer. (Yes, internal links are very good to have. Just ask Wikipedia).