Update

One new tab added. Open in browser view if it is not visible. (25/08/2022 08:48)

Anti-palindrome strings

Language : C
(NOTE : Try a few times yourself before moving to the solution)


#include <stdio.h>
#include <stdbool.h>
#include <malloc.h>

int isNotPalidrome(char * str)
{
	int fr[26] = {0};
	int len = strlen(str);
	//printf("%s\n",str);
	int i = 0;
	while(i < len)
	{
		fr[str[i] - 97]++;
		i++;
	}

	int allowedodd = 0;

	for(int i = 0; i < 26; i++)
	{
		//printf("%d ",fr[i]);
		if(fr[i]%2!=0)
			allowedodd++;

		if(allowedodd>1)
			return 1;
	}

	return 0;
}
void sort(char * s)
{
	int n = strlen(s);
	int alp[26]={0};
	for(int i=0;i

No comments: