Posts

Update the author and email address of every commit on a repository

source: stackoverflow.com

Top K Frequent by Bucket Sort/Linq

By Bucket Sort By Linq

Longest Consecutive with HashSet

content

TwoSum with Dictionary

Anagram with Hashtable

Consuming a WCF with error: "The caller was not authenticated by the service"

Consuming a WCF service when it hosted on a work group server may cause raise some errors such as: "The caller was not authenticated by the service". I tackled it by adding the following lines to my code:

Distinct in a List of Objects

If you have a list of objects and in the list there are repetitive elements, If you want to delete duplicate elements, you may be want to use Linq Distinct() method. But the result may be not your desire because it does not work properly. For getting the best result in your work, it is better to use the following method for doing distinct in your list: 1: var listOfObject = items 2: .GroupBy(l => l.PropertyToCompare) //Name of you propery    3: .Select(l => l.First());