In this research, we undertake intelligent skin cancer diagnosis based on dermoscopic images using a variant of the Particle Swarm Optimization (PSO) algorithm for feature optimization. Since the identification of the most significant discriminative characteristics of the benign and malignant skin lesions plays an important role in robust skin cancer detection, the proposed PSO algorithm is employed for feature optimization. It incorporates not only subswarms, local and global food and enemy signals, attraction and flee operations, and mutation-based local exploitation, but also diverse matrix representations to mitigate premature convergence of the original PSO algorithm. Specifically, two remote swarm leaders, which show similar fitness but low position proximity, are used to lead the subswarm-based search and to enable the exploration of more distinctive search regions. Modified velocity updating strategies are also proposed to enable the particles to follow multiple swarm leaders and avoid the local and global worst individuals, partially (i.e. in randomly selected sub-dimensions) and fully (in every dimension), with an attempt to search for global optima. Probability distribution and dynamic matrix representations are used to diversify the search process. Evaluated with multiple skin lesion and UCI databases and diverse unimodal and multimodal benchmark functions, the proposed PSO variant shows a superior performance over those of other advanced and classical search methods for identifying discriminative features that facilitate benign and malignant lesion classification as well as for solving diverse optimization problems with different landscapes. The Wilcoxon rank sum test is adopted to further ascertain superiority of the proposed algorithm over other methods statistically.